diff mbox series

power: supply: rk817: check correct variable

Message ID Y0puvQLWS/rQ7hSb@kili (mailing list archive)
State Handled Elsewhere, archived
Headers show
Series power: supply: rk817: check correct variable | expand

Commit Message

Dan Carpenter Oct. 15, 2022, 8:26 a.m. UTC
This code checks "->chg_ps" twice when it was supposed to check
"->bat_ps".

Fixes: 11cb8da0189b ("power: supply: Add charger driver for Rockchip RK817")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 drivers/power/supply/rk817_charger.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

Comments

Sebastian Reichel Oct. 19, 2022, 11:43 p.m. UTC | #1
Hi,

On Sat, Oct 15, 2022 at 11:26:37AM +0300, Dan Carpenter wrote:
> This code checks "->chg_ps" twice when it was supposed to check
> "->bat_ps".
> 
> Fixes: 11cb8da0189b ("power: supply: Add charger driver for Rockchip RK817")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---

Thanks, queued to fixes branch.

-- Sebastian

>  drivers/power/supply/rk817_charger.c | 8 +++-----
>  1 file changed, 3 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/power/supply/rk817_charger.c b/drivers/power/supply/rk817_charger.c
> index 635f051b0821..4e9c7b191266 100644
> --- a/drivers/power/supply/rk817_charger.c
> +++ b/drivers/power/supply/rk817_charger.c
> @@ -1116,14 +1116,12 @@ static int rk817_charger_probe(struct platform_device *pdev)
>  
>  	charger->bat_ps = devm_power_supply_register(&pdev->dev,
>  						     &rk817_bat_desc, &pscfg);
> -
> -	charger->chg_ps = devm_power_supply_register(&pdev->dev,
> -						     &rk817_chg_desc, &pscfg);
> -
> -	if (IS_ERR(charger->chg_ps))
> +	if (IS_ERR(charger->bat_ps))
>  		return dev_err_probe(dev, -EINVAL,
>  				     "Battery failed to probe\n");
>  
> +	charger->chg_ps = devm_power_supply_register(&pdev->dev,
> +						     &rk817_chg_desc, &pscfg);
>  	if (IS_ERR(charger->chg_ps))
>  		return dev_err_probe(dev, -EINVAL,
>  				     "Charger failed to probe\n");
> -- 
> 2.35.1
>
Chris Morgan Oct. 22, 2022, 3:39 a.m. UTC | #2
On Sat, Oct 15, 2022 at 11:26:37AM +0300, Dan Carpenter wrote:
> This code checks "->chg_ps" twice when it was supposed to check
> "->bat_ps".
> 
> Fixes: 11cb8da0189b ("power: supply: Add charger driver for Rockchip RK817")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Not sure how I missed this, but good catch. Sorry I've been away all
week doing work stuff.

Tested-by: Chris Morgan <macromorgan@hotmail.com>

> ---
>  drivers/power/supply/rk817_charger.c | 8 +++-----
>  1 file changed, 3 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/power/supply/rk817_charger.c b/drivers/power/supply/rk817_charger.c
> index 635f051b0821..4e9c7b191266 100644
> --- a/drivers/power/supply/rk817_charger.c
> +++ b/drivers/power/supply/rk817_charger.c
> @@ -1116,14 +1116,12 @@ static int rk817_charger_probe(struct platform_device *pdev)
>  
>  	charger->bat_ps = devm_power_supply_register(&pdev->dev,
>  						     &rk817_bat_desc, &pscfg);
> -
> -	charger->chg_ps = devm_power_supply_register(&pdev->dev,
> -						     &rk817_chg_desc, &pscfg);
> -
> -	if (IS_ERR(charger->chg_ps))
> +	if (IS_ERR(charger->bat_ps))
>  		return dev_err_probe(dev, -EINVAL,
>  				     "Battery failed to probe\n");
>  
> +	charger->chg_ps = devm_power_supply_register(&pdev->dev,
> +						     &rk817_chg_desc, &pscfg);
>  	if (IS_ERR(charger->chg_ps))
>  		return dev_err_probe(dev, -EINVAL,
>  				     "Charger failed to probe\n");
> -- 
> 2.35.1
>
diff mbox series

Patch

diff --git a/drivers/power/supply/rk817_charger.c b/drivers/power/supply/rk817_charger.c
index 635f051b0821..4e9c7b191266 100644
--- a/drivers/power/supply/rk817_charger.c
+++ b/drivers/power/supply/rk817_charger.c
@@ -1116,14 +1116,12 @@  static int rk817_charger_probe(struct platform_device *pdev)
 
 	charger->bat_ps = devm_power_supply_register(&pdev->dev,
 						     &rk817_bat_desc, &pscfg);
-
-	charger->chg_ps = devm_power_supply_register(&pdev->dev,
-						     &rk817_chg_desc, &pscfg);
-
-	if (IS_ERR(charger->chg_ps))
+	if (IS_ERR(charger->bat_ps))
 		return dev_err_probe(dev, -EINVAL,
 				     "Battery failed to probe\n");
 
+	charger->chg_ps = devm_power_supply_register(&pdev->dev,
+						     &rk817_chg_desc, &pscfg);
 	if (IS_ERR(charger->chg_ps))
 		return dev_err_probe(dev, -EINVAL,
 				     "Charger failed to probe\n");