Commit e1285417 authored by Dan Carpenter's avatar Dan Carpenter Committed by Sebastian Reichel

power: supply: ltc3651-charger: fix some error codes in probe

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: c94d4ed0 ("power: supply: Add ltc3651-charger driver")
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
[Wei Yongjun found the same issue independently]
Signed-off-by: default avatarWei Yongjun <weiyongjun1@huawei.com>
Acked-by: default avatarMike Looijmans <mike.looijmans@topic.nl>
Signed-off-by: default avatarSebastian Reichel <sre@kernel.org>
parent 105df60f
...@@ -110,21 +110,21 @@ static int ltc3651_charger_probe(struct platform_device *pdev) ...@@ -110,21 +110,21 @@ static int ltc3651_charger_probe(struct platform_device *pdev)
ltc3651_charger->acpr_gpio = devm_gpiod_get(&pdev->dev, ltc3651_charger->acpr_gpio = devm_gpiod_get(&pdev->dev,
"lltc,acpr", GPIOD_IN); "lltc,acpr", GPIOD_IN);
if (IS_ERR(ltc3651_charger->acpr_gpio)) { 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); dev_err(&pdev->dev, "Failed to acquire acpr GPIO: %d\n", ret);
return ret; return ret;
} }
ltc3651_charger->fault_gpio = devm_gpiod_get_optional(&pdev->dev, ltc3651_charger->fault_gpio = devm_gpiod_get_optional(&pdev->dev,
"lltc,fault", GPIOD_IN); "lltc,fault", GPIOD_IN);
if (IS_ERR(ltc3651_charger->fault_gpio)) { 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); dev_err(&pdev->dev, "Failed to acquire fault GPIO: %d\n", ret);
return ret; return ret;
} }
ltc3651_charger->chrg_gpio = devm_gpiod_get_optional(&pdev->dev, ltc3651_charger->chrg_gpio = devm_gpiod_get_optional(&pdev->dev,
"lltc,chrg", GPIOD_IN); "lltc,chrg", GPIOD_IN);
if (IS_ERR(ltc3651_charger->chrg_gpio)) { 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); dev_err(&pdev->dev, "Failed to acquire chrg GPIO: %d\n", ret);
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment