Skip to contentSkip to conversation

power: supply: ucs1002: Fix checking return value of devm_regulator_register

PATCH In review Axel Lin 2 participants 2 messages May 9, 2019 Power supply

lore
Share & tools
lore

Axel Lin

author
#0 lore raw

PATCH 1/1 power: supply: ucs1002: Fix checking return value of devm_regulator_register

Current code checks wrong return value, it should check rdev rather than info->charger. Fix it.

---
 drivers/power/supply/ucs1002_power.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/power/supply/ucs1002_power.c +1 -1
index d66b4eff9b7a..33409b13232a 100644
@@ -592,7 +592,7 @@ static int ucs1002_probe(struct i2c_client *client,
 
 	rdev = devm_regulator_register(dev, info->regulator_descriptor,
 				       &regulator_config);
-	ret = PTR_ERR_OR_ZERO(info->charger);
+	ret = PTR_ERR_OR_ZERO(rdev);
 	if (ret) {
 		dev_err(dev, "Failed to register VBUS regulator: %d\n", ret);
 		return ret;
Signature · 1 line
2.20.1
Reviewed-by on v1 1/1
#1 lore raw

Hi Axel,

Probably makes sense squash the both patches that you sent regarding ucs1002.

Quoted 3 lines · Axel Lin

Current code checks wrong return value, it should check rdev rather than info->charger. Fix it.

That should probably include a Fixes tag.

Quoted 1 line

The change itself:

Quoted 10 lines
---
 drivers/power/supply/ucs1002_power.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/power/supply/ucs1002_power.c +0 -0
index d66b4eff9b7a..33409b13232a 100644

drivers/power/supply/ucs1002_power.c static int ucs1002_probe(struct i2c_client *client, · line 598

Quoted 8 lines
drivers/power/supply/ucs1002_power.c +1 -1
@@ -592,7 +592,7 @@ static int ucs1002_probe(struct i2c_client *client,
 
 	rdev = devm_regulator_register(dev, info->regulator_descriptor,
 				       &regulator_config);
-	ret = PTR_ERR_OR_ZERO(info->charger);
+	ret = PTR_ERR_OR_ZERO(rdev);
 	if (ret) {
 		dev_err(dev, "Failed to register VBUS regulator: %d\n", ret);
 		return ret;

Thanks,
Enric