[PATCH] pwm: stm32: Fix error message to not describe the previous error path

Uwe Kleine-König u.kleine-koenig at baylibre.com
Thu Jun 20 23:54:17 PDT 2024


"Failed to lock the clock" is an appropriate error message for
clk_rate_exclusive_get() failing, but not for the clock running too
fast for the driver's calculations.

Adapt the error message accordingly.

Fixes: d44d635635a7 ("pwm: stm32: Fix for settings using period > UINT32_MAX")
Signed-off-by: Uwe Kleine-König <u.kleine-koenig at baylibre.com>
---
Hello,

I just found this issue while preparing a PR including the two pwm-stm32
fixes available at
https://lore.kernel.org/all/cover.1718788826.git.u.kleine-koenig@baylibre.com/ .

This patch being trivial and useful I'll send it along with the other
two. So when you notice this patch it's probably already to late to send
a review :-)

d44d635635a7 was only included in v6.10-rc1, so no stable tag necessary.

Best regards
Uwe

 drivers/pwm/pwm-stm32.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/pwm/pwm-stm32.c b/drivers/pwm/pwm-stm32.c
index a2f231d13a9f..cd7245183360 100644
--- a/drivers/pwm/pwm-stm32.c
+++ b/drivers/pwm/pwm-stm32.c
@@ -673,7 +673,8 @@ static int stm32_pwm_probe(struct platform_device *pdev)
 	 * .apply() won't overflow.
 	 */
 	if (clk_get_rate(priv->clk) > 1000000000)
-		return dev_err_probe(dev, -EINVAL, "Failed to lock clock\n");
+		return dev_err_probe(dev, -EINVAL, "Clock freq too high (%lu)\n",
+				     clk_get_rate(priv->clk));
 
 	chip->ops = &stm32pwm_ops;
 

base-commit: 1613e604df0cd359cf2a7fbd9be7a0bcfacfabd0
-- 
2.43.0




More information about the linux-arm-kernel mailing list