]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
pwm: stm32: Refuse too small period requests
authorUwe Kleine-König <u.kleine-koenig@baylibre.com>
Fri, 21 Jun 2024 14:37:12 +0000 (16:37 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 5 Jul 2024 07:34:05 +0000 (09:34 +0200)
commitd83df7de2b0a2314fa73181c7b55ea0eabf51052
treeae524ff89adf974bbb37b0c84962d8ad661f5cef
parent00432384ec406702710b77dfb17981a4e529b2b8
pwm: stm32: Refuse too small period requests

commit c45fcf46ca2368dafe7e5c513a711a6f0f974308 upstream.

If period_ns is small, prd might well become 0. Catch that case because
otherwise with

regmap_write(priv->regmap, TIM_ARR, prd - 1);

a few lines down quite a big period is configured.

Fixes: 7edf7369205b ("pwm: Add driver for STM32 plaftorm")
Cc: stable@vger.kernel.org
Reviewed-by: Trevor Gamblin <tgamblin@baylibre.com>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
Link: https://lore.kernel.org/r/b86f62f099983646f97eeb6bfc0117bb2d0c340d.1718979150.git.u.kleine-koenig@baylibre.com
Signed-off-by: Uwe Kleine-König <ukleinek@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/pwm/pwm-stm32.c