power: supply: Reset err after not finding static battery

Otherwise power_supply_get_battery_info always returns -ENODEV
on devices that do not have a static battery, even when a simple
battery is found.

Fixes: c8aee3f41c ("power: supply: Static data for Samsung batteries")
Signed-off-by: Yassine Oudjana <y.oudjana@protonmail.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
This commit is contained in:
Yassine Oudjana 2022-03-29 03:34:03 +00:00 committed by Sebastian Reichel
parent 5c7d28c6f6
commit 581045ed5c
1 changed files with 6 additions and 0 deletions

View File

@ -604,6 +604,12 @@ int power_supply_get_battery_info(struct power_supply *psy,
err = samsung_sdi_battery_get_info(&psy->dev, value, &info);
if (!err)
goto out_ret_pointer;
else if (err == -ENODEV)
/*
* Device does not have a static battery.
* Proceed to look for a simple battery.
*/
err = 0;
if (strcmp("simple-battery", value)) {
err = -ENODEV;