diff mbox series

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

Message ID 20190509122636.21885-1-axel.lin@ingics.com (mailing list archive)
State Not Applicable, archived
Headers show
Series power: supply: ucs1002: Fix checking return value of devm_regulator_register | expand

Commit Message

Axel Lin May 9, 2019, 12:26 p.m. UTC
Current code checks wrong return value, it should check rdev rather than
info->charger. Fix it.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
---
 drivers/power/supply/ucs1002_power.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Enric Balletbo i Serra May 9, 2019, 12:43 p.m. UTC | #1
Hi Axel,

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

On 9/5/19 14:26, Axel Lin wrote:
> Current code checks wrong return value, it should check rdev rather than
> info->charger. Fix it.
> 

That should probably include a Fixes tag.

> Signed-off-by: Axel Lin <axel.lin@ingics.com>

The change itself:

Reviewed-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>

> ---
>  drivers/power/supply/ucs1002_power.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/power/supply/ucs1002_power.c b/drivers/power/supply/ucs1002_power.c
> index d66b4eff9b7a..33409b13232a 100644
> --- a/drivers/power/supply/ucs1002_power.c
> +++ b/drivers/power/supply/ucs1002_power.c
> @@ -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
diff mbox series

Patch

diff --git a/drivers/power/supply/ucs1002_power.c b/drivers/power/supply/ucs1002_power.c
index d66b4eff9b7a..33409b13232a 100644
--- a/drivers/power/supply/ucs1002_power.c
+++ b/drivers/power/supply/ucs1002_power.c
@@ -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;