Skip to content

Commit 80bd81c

Browse files
author
Uwe Kleine-König
committed
pwm: stm32: Add error messages in .probe()'s error paths
Giving an indication about the problem if probing a device fails is a nice move. Do that for the stm32 pwm driver. Reviewed-by: Fabrice Gasnier <fabrice.gasnier@foss.st.com> Link: https://lore.kernel.org/r/20240315145443.982807-2-u.kleine-koenig@pengutronix.de Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
1 parent 38ae714 commit 80bd81c

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

drivers/pwm/pwm-stm32.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -648,11 +648,13 @@ static int stm32_pwm_probe(struct platform_device *pdev)
648648
priv->max_arr = ddata->max_arr;
649649

650650
if (!priv->regmap || !priv->clk)
651-
return -EINVAL;
651+
return dev_err_probe(dev, -EINVAL, "Failed to get %s\n",
652+
priv->regmap ? "clk" : "regmap");
652653

653654
ret = stm32_pwm_probe_breakinputs(priv, np);
654655
if (ret)
655-
return ret;
656+
return dev_err_probe(dev, ret,
657+
"Failed to configure breakinputs\n");
656658

657659
stm32_pwm_detect_complementary(priv);
658660

@@ -664,7 +666,8 @@ static int stm32_pwm_probe(struct platform_device *pdev)
664666

665667
ret = devm_pwmchip_add(dev, chip);
666668
if (ret < 0)
667-
return ret;
669+
return dev_err_probe(dev, ret,
670+
"Failed to register pwmchip\n");
668671

669672
platform_set_drvdata(pdev, chip);
670673

0 commit comments

Comments
 (0)