Skip to content

Commit 12bdf47

Browse files
M-Vaittinensre
authored andcommitted
power: supply: bd71828: Use dev_err_probe()
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. Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com> Link: https://patch.msgid.link/aWi_GG74sZRfajA_@mva-rohm Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
1 parent cb3aa2b commit 12bdf47

1 file changed

Lines changed: 3 additions & 6 deletions

File tree

drivers/power/supply/bd71828-power.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1058,10 +1058,8 @@ static int bd71828_power_probe(struct platform_device *pdev)
10581058
pwr->regmap = dev_get_regmap(pdev->dev.parent, NULL);
10591059
else
10601060
pwr->regmap = dev_get_regmap(pdev->dev.parent, "wrap-map");
1061-
if (!pwr->regmap) {
1062-
dev_err(&pdev->dev, "No parent regmap\n");
1063-
return -EINVAL;
1064-
}
1061+
if (!pwr->regmap)
1062+
return dev_err_probe(&pdev->dev, -EINVAL, "No parent regmap\n");
10651063

10661064
pwr->dev = &pdev->dev;
10671065

@@ -1083,8 +1081,7 @@ static int bd71828_power_probe(struct platform_device *pdev)
10831081
dev_dbg(pwr->dev, "Found ROHM BD72720\n");
10841082
break;
10851083
default:
1086-
dev_err(pwr->dev, "Unknown PMIC\n");
1087-
return -EINVAL;
1084+
return dev_err_probe(pwr->dev, -EINVAL, "Unknown PMIC\n");
10881085
}
10891086

10901087
ret = bd7182x_get_rsens(pwr);

0 commit comments

Comments
 (0)