Skip to content

Commit

Permalink
power: supply: ltc3651-charger: fix some error codes in probe
Browse files Browse the repository at this point in the history
There are several cut and past bugs here.  ltc3651_charger->charger is
NULL at this point, so we return success instead of the intended error
codes.

Fixes: c94d4ed ("power: supply: Add ltc3651-charger driver")
Signed-off-by: Dan Carpenter <[email protected]>
[Wei Yongjun found the same issue independently]
Signed-off-by: Wei Yongjun <[email protected]>
Acked-by: Mike Looijmans <[email protected]>
Signed-off-by: Sebastian Reichel <[email protected]>
  • Loading branch information
Dan Carpenter authored and sre committed Jun 8, 2017
1 parent 105df60 commit e128541
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions drivers/power/supply/ltc3651-charger.c
Original file line number Diff line number Diff line change
Expand Up @@ -110,21 +110,21 @@ static int ltc3651_charger_probe(struct platform_device *pdev)
ltc3651_charger->acpr_gpio = devm_gpiod_get(&pdev->dev,
"lltc,acpr", GPIOD_IN);
if (IS_ERR(ltc3651_charger->acpr_gpio)) {
ret = PTR_ERR(ltc3651_charger->charger);
ret = PTR_ERR(ltc3651_charger->acpr_gpio);
dev_err(&pdev->dev, "Failed to acquire acpr GPIO: %d\n", ret);
return ret;
}
ltc3651_charger->fault_gpio = devm_gpiod_get_optional(&pdev->dev,
"lltc,fault", GPIOD_IN);
if (IS_ERR(ltc3651_charger->fault_gpio)) {
ret = PTR_ERR(ltc3651_charger->charger);
ret = PTR_ERR(ltc3651_charger->fault_gpio);
dev_err(&pdev->dev, "Failed to acquire fault GPIO: %d\n", ret);
return ret;
}
ltc3651_charger->chrg_gpio = devm_gpiod_get_optional(&pdev->dev,
"lltc,chrg", GPIOD_IN);
if (IS_ERR(ltc3651_charger->chrg_gpio)) {
ret = PTR_ERR(ltc3651_charger->charger);
ret = PTR_ERR(ltc3651_charger->chrg_gpio);
dev_err(&pdev->dev, "Failed to acquire chrg GPIO: %d\n", ret);
return ret;
}
Expand Down

0 comments on commit e128541

Please sign in to comment.