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
- Re: [PATCH 4/5] configs: stm32mp13: Enable MFD timer ... Patrice CHOTARD
- Re: [PATCH 4/5] configs: stm32mp13: Enable MFD ti... 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 3/5] pwm: stm32: add driver to support... 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
- [PATCH 1/5] dm: pwm: Check if duty_ns is lower than period... Cheick Traore
- Re: [PATCH 1/5] dm: pwm: Check if duty_ns is lower th... Patrice CHOTARD
- Re: [PATCH 1/5] dm: pwm: Check if duty_ns is lowe... Patrice CHOTARD
- Re: [Uboot-stm32] [PATCH 1/5] dm: pwm: Check ... Patrice CHOTARD
- Re: [Uboot-stm32] [PATCH 1/5] dm: pwm: Ch... Cheick TRAORE
- Re: [Uboot-stm32] [PATCH 1/5] dm: pw... Patrice CHOTARD