]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
pwm: fsl-ftm: Handle clk_get_rate() returning 0
authorUwe Kleine-König <u.kleine-koenig@baylibre.com>
Tue, 1 Apr 2025 10:29:01 +0000 (12:29 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 25 Apr 2025 08:45:21 +0000 (10:45 +0200)
commit0e1816d8c27731fceadcd95db7cb7014502d6dd0
tree6bd66b800496957dc22b961e983427e56d0c6486
parentd837f37cd4d9779f1fc52e41d5c7009c8f63317c
pwm: fsl-ftm: Handle clk_get_rate() returning 0

[ Upstream commit 928446a5302eee30ebb32075c0db5dda5a138fb7 ]

Considering that the driver doesn't enable the used clocks (and also
that clk_get_rate() returns 0 if CONFIG_HAVE_CLK is unset) better check
the return value of clk_get_rate() for being non-zero before dividing by
it.

Fixes: 3479bbd1e1f8 ("pwm: fsl-ftm: More relaxed permissions for updating period")
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
Link: https://lore.kernel.org/r/b68351a51017035651bc62ad3146afcb706874f0.1743501688.git.u.kleine-koenig@baylibre.com
Signed-off-by: Uwe Kleine-König <ukleinek@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/pwm/pwm-fsl-ftm.c