diff options
| author | Jakub Kicinski <[email protected]> | 2025-04-17 19:23:49 +0000 |
|---|---|---|
| committer | Jakub Kicinski <[email protected]> | 2025-04-17 19:26:50 +0000 |
| commit | 240ce924d2718b8f6f622f2a9a9c219b9da736e8 (patch) | |
| tree | a417bc3d31264e2c317614b25c4a7a6f688916b5 /drivers/pwm/pwm-fsl-ftm.c | |
| parent | Merge branch 'net-pktgen-fix-checkpatch-code-style-errors-warnings' (diff) | |
| parent | Merge tag 'net-6.15-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/net... (diff) | |
| download | kernel-240ce924d2718b8f6f622f2a9a9c219b9da736e8.tar.gz kernel-240ce924d2718b8f6f622f2a9a9c219b9da736e8.zip | |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net
Cross-merge networking fixes after downstream PR (net-6.15-rc3).
No conflicts. Adjacent changes:
tools/net/ynl/pyynl/ynl_gen_c.py
4d07bbf2d456 ("tools: ynl-gen: don't declare loop iterator in place")
7e8ba0c7de2b ("tools: ynl: don't use genlmsghdr in classic netlink")
Signed-off-by: Jakub Kicinski <[email protected]>
Diffstat (limited to 'drivers/pwm/pwm-fsl-ftm.c')
| -rw-r--r-- | drivers/pwm/pwm-fsl-ftm.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/pwm/pwm-fsl-ftm.c b/drivers/pwm/pwm-fsl-ftm.c index 2510c10ca473..c45a5fca4cbb 100644 --- a/drivers/pwm/pwm-fsl-ftm.c +++ b/drivers/pwm/pwm-fsl-ftm.c @@ -118,6 +118,9 @@ static unsigned int fsl_pwm_ticks_to_ns(struct fsl_pwm_chip *fpc, unsigned long long exval; rate = clk_get_rate(fpc->clk[fpc->period.clk_select]); + if (rate >> fpc->period.clk_ps == 0) + return 0; + exval = ticks; exval *= 1000000000UL; do_div(exval, rate >> fpc->period.clk_ps); @@ -190,6 +193,9 @@ static unsigned int fsl_pwm_calculate_duty(struct fsl_pwm_chip *fpc, unsigned int period = fpc->period.mod_period + 1; unsigned int period_ns = fsl_pwm_ticks_to_ns(fpc, period); + if (!period_ns) + return 0; + duty = (unsigned long long)duty_ns * period; do_div(duty, period_ns); |
