On 3/6/25 15:13, Patrice CHOTARD wrote: > > > On 3/6/25 11:56, Cheick Traore wrote: >> It was possible to provide a duty_ns greater than period_ns to >> "pwm config" command. The framework must check the values before >> providing them to drivers. >> >> Signed-off-by: Cheick Traore <cheick.tra...@foss.st.com> >> --- >> >> drivers/pwm/pwm-uclass.c | 3 +++ >> 1 file changed, 3 insertions(+) >> >> diff --git a/drivers/pwm/pwm-uclass.c b/drivers/pwm/pwm-uclass.c >> index 6543db1d623..b4491f7dcd4 100644 >> --- a/drivers/pwm/pwm-uclass.c >> +++ b/drivers/pwm/pwm-uclass.c >> @@ -27,6 +27,9 @@ int pwm_set_config(struct udevice *dev, uint channel, uint >> period_ns, >> if (!ops->set_config) >> return -ENOSYS; >> >> + if (duty_ns > period_ns) >> + return -EINVAL; >> + >> return ops->set_config(dev, channel, period_ns, duty_ns); >> } >> > Reviewed-by: Patrice Chotard <patrice.chot...@foss.st.com> > > Thanks > Patrice Applied to u-boot-stm32/next Thanks Patrice
- [PATCH 2/5] mach-stm32: add multifunction timer driver sup... Cheick Traore
- Re: [PATCH 2/5] mach-stm32: add multifunction timer d... Fabrice Gasnier
- Re: [PATCH 2/5] mach-stm32: add multifunction timer d... Patrice CHOTARD
- Re: [PATCH 2/5] mach-stm32: add multifunction tim... Patrice CHOTARD
- [PATCH 4/5] configs: stm32mp13: Enable MFD timer and PWM f... Cheick Traore
- Re: [PATCH 4/5] configs: stm32mp13: Enable MFD timer ... Patrice CHOTARD
- [PATCH 3/5] pwm: stm32: add driver to support pwm with tim... Cheick Traore
- Re: [PATCH 3/5] pwm: stm32: add driver to support pwm... Fabrice Gasnier
- Re: [PATCH 3/5] pwm: stm32: add driver to support pwm... Patrice CHOTARD
- Re: [PATCH 1/5] dm: pwm: Check if duty_ns is lower than pe... Patrice CHOTARD
- Re: [PATCH 1/5] dm: pwm: Check if duty_ns is lower th... Patrice CHOTARD
- Re: [Uboot-stm32] [PATCH 1/5] dm: pwm: Check if d... Patrice CHOTARD
- Re: [Uboot-stm32] [PATCH 1/5] dm: pwm: Check ... Cheick TRAORE
- Re: [Uboot-stm32] [PATCH 1/5] dm: pwm: Ch... Patrice CHOTARD
- [PATCH 5/5] ARM: dts: stm32: Add TIMERS inverted PWM chann... Cheick Traore
- Re: [PATCH 5/5] ARM: dts: stm32: Add TIMERS inverted ... Patrice CHOTARD
- Re: [PATCH 5/5] ARM: dts: stm32: Add TIMERS inver... Patrice CHOTARD