Skip to contentSkip to conversation

regulator: pwm: Do not print error on probe deferral

PATCH In review Thierry Reding 2 participants 2 messages Aug 6, 2020 Voltage and current regulator framework

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 regulator: pwm: Do not print error on probe deferral

From: Thierry Reding <[email protected]>

When the pwm-regulator driver fails to find the enable GPIO because of probe deferral, prevent it from potentially spamming the kernel log with error messages that are not useful.

---
 drivers/regulator/pwm-regulator.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/regulator/pwm-regulator.c +3 -1
index 3234b118b53e..dc99ac9b0cdf 100644
@@ -370,7 +370,9 @@ static int pwm_regulator_probe(struct platform_device *pdev)
 						    gpio_flags);
 	if (IS_ERR(drvdata->enb_gpio)) {
 		ret = PTR_ERR(drvdata->enb_gpio);
-		dev_err(&pdev->dev, "Failed to get enable GPIO: %d\n", ret);
+		if (ret != -EPROBE_DEFER)
+			dev_err(&pdev->dev, "Failed to get enable GPIO: %d\n", ret);
+
 		return ret;
 	}
 
Signature · 1 line
2.27.0
maintainer
#1 lore raw

drivers/regulator/pwm-regulator.c static int pwm_regulator_probe(struct platform_device *pdev) · line 374

Quoted 5 lines · Thierry Reding
drivers/regulator/pwm-regulator.c +2 -1
 	if (IS_ERR(drvdata->enb_gpio)) {
 		ret = PTR_ERR(drvdata->enb_gpio);
-		dev_err(&pdev->dev, "Failed to get enable GPIO: %d\n", ret);
+		if (ret != -EPROBE_DEFER)
+			dev_err(&pdev->dev, "Failed to get enable GPIO: %d\n", ret);

This will not provide any diagnostics if there's an issue with probe deferral it'll be hard for people to figure out what's going on. At most lower the severity to dev_dbg() but don't totally remove the logging.