Skip to contentSkip to conversation

regulator: rk808: simplify one error branch with dev_err_probe

PATCH Applied Ahmad Fatoum 2 participants 2 messages Jan 9, 2023 – Jan 10, 2023 Voltage and current regulator framework

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 regulator: rk808: simplify one error branch with dev_err_probe

This has the added benefit of recording the error message.

---
 drivers/regulator/rk808-regulator.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/regulator/rk808-regulator.c +3 -4
index 3da6cca294ae..8c96b99c9be5 100644
@@ -783,10 +783,9 @@ static int rk808_regulator_register(struct rk808 *rk808, int id,
 	cfg->rdev.regmap = rk808->regmap;
 
 	ret = of_regulator_register(&cfg->rdev, match->of_node);
-	if (ret) {
-		dev_err(dev, "failed to register %s regulator\n", match->name);
-		return ret;
-	}
+	if (ret)
+		return dev_err_probe(dev, ret, "failed to register %s regulator\n",
+				     match->name);
 
 	dev_dbg(dev, "registered %s\n", match->name);
 
Signature · 1 line
2.38.1
Applied
#1 lore raw
Quoted 6 lines · Ahmad Fatoum

This has the added benefit of recording the error message.

---
 drivers/regulator/rk808-regulator.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

Applied, thanks

Sascha

Quoted 24 lines
drivers/regulator/rk808-regulator.c +3 -4
index 3da6cca294ae..8c96b99c9be5 100644
@@ -783,10 +783,9 @@ static int rk808_regulator_register(struct rk808 *rk808, int id,
 	cfg->rdev.regmap = rk808->regmap;
 
 	ret = of_regulator_register(&cfg->rdev, match->of_node);
-	if (ret) {
-		dev_err(dev, "failed to register %s regulator\n", match->name);
-		return ret;
-	}
+	if (ret)
+		return dev_err_probe(dev, ret, "failed to register %s regulator\n",
+				     match->name);
 
 	dev_dbg(dev, "registered %s\n", match->name);
 
Signature · 1 line
2.38.1
Signature · 4 lines
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |