Skip to contentSkip to conversation

power: supply: bd71828: Use dev_err_probe()

PATCH Applied Matti Vaittinen 2 participants 2 messages Jan 15 – Jan 30

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 power: supply: bd71828: Use dev_err_probe()

From: Matti Vaittinen <[email protected]>

The driver uses separate error printing and error returning at probe() for locations where the error value is hard-coded and can't be EPROBE_DEFER. This helps to omit the extra return value check which is done in dev_err_probe().

Using the dev_err_probe() has some other benefits besides handling the -EPROBE_DEFER though, like standardizing the print for error numbers. Some believe thes outweigh the benefit of skipping the extra check.

Use dev_err_probe() consistently in the bd71828 power-supply probe.

---

This patch depends on, and is done on top of, the series:
https://lore.kernel.org/all/[email protected]/
as discussed:
https://lore.kernel.org/all/aWbg3PTf677Jt9rG@venus/

 drivers/power/supply/bd71828-power.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)
drivers/power/supply/bd71828-power.c +3 -6
index 438e220a9cb7..0e00acb58993 100644
@@ -1058,10 +1058,8 @@ static int bd71828_power_probe(struct platform_device *pdev)
 		pwr->regmap = dev_get_regmap(pdev->dev.parent, NULL);
 	else
 		pwr->regmap = dev_get_regmap(pdev->dev.parent, "wrap-map");
-	if (!pwr->regmap) {
-		dev_err(&pdev->dev, "No parent regmap\n");
-		return -EINVAL;
-	}
+	if (!pwr->regmap)
+		return dev_err_probe(&pdev->dev, -EINVAL, "No parent regmap\n");
 
 	pwr->dev = &pdev->dev;
 
@@ -1083,8 +1081,7 @@ static int bd71828_power_probe(struct platform_device *pdev)
 		dev_dbg(pwr->dev, "Found ROHM BD72720\n");
 		break;
 	default:
-		dev_err(pwr->dev, "Unknown PMIC\n");
-		return -EINVAL;
+		return dev_err_probe(pwr->dev, -EINVAL, "Unknown PMIC\n");
 	}
 
 	ret = bd7182x_get_rsens(pwr);
Signature · 1 line
2.52.0
#1 lore raw
Quoted 10 lines · Matti Vaittinen

The driver uses separate error printing and error returning at probe() for locations where the error value is hard-coded and can't be EPROBE_DEFER. This helps to omit the extra return value check which is done in dev_err_probe().

Using the dev_err_probe() has some other benefits besides handling the -EPROBE_DEFER though, like standardizing the print for error numbers. Some believe thes outweigh the benefit of skipping the extra check.

[...]

Applied, thanks!

[1/1] power: supply: bd71828: Use dev_err_probe()

      commit: 12bdf471e374b34cb0e48b29bb9eb9127ed26fc5

Best regards,

Signature · 1 line
Sebastian Reichel <[email protected]>