diff options
author | Stefan Agner <stefan.agner@toradex.com> | 2019-10-14 11:29:40 +0200 |
---|---|---|
committer | Stefan Agner <stefan.agner@toradex.com> | 2019-10-14 11:29:40 +0200 |
commit | f2fbbb0846d4d0737cd5bbf0e7a6a136f0334c5e (patch) | |
tree | bc8a63d51e366fb4d65f6547497e33ad3c3c4869 /drivers/pwm/pwm-stm32-lp.c | |
parent | 73e1c506b9ffb348af15763d62b3677378bd8d91 (diff) | |
parent | a2fc8ee6676067f27d2f5c6e4d512adff3d9938c (diff) |
Merge tag 'v5.3.6' into toradex_5.3.y
This is the 5.3.6 stable release
Diffstat (limited to 'drivers/pwm/pwm-stm32-lp.c')
-rw-r--r-- | drivers/pwm/pwm-stm32-lp.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/pwm/pwm-stm32-lp.c b/drivers/pwm/pwm-stm32-lp.c index 2211a642066d..97a9afa191ee 100644 --- a/drivers/pwm/pwm-stm32-lp.c +++ b/drivers/pwm/pwm-stm32-lp.c @@ -59,6 +59,12 @@ static int stm32_pwm_lp_apply(struct pwm_chip *chip, struct pwm_device *pwm, /* Calculate the period and prescaler value */ div = (unsigned long long)clk_get_rate(priv->clk) * state->period; do_div(div, NSEC_PER_SEC); + if (!div) { + /* Clock is too slow to achieve requested period. */ + dev_dbg(priv->chip.dev, "Can't reach %u ns\n", state->period); + return -EINVAL; + } + prd = div; while (div > STM32_LPTIM_MAX_ARR) { presc++; |