Commit 581045ed authored by Yassine Oudjana's avatar Yassine Oudjana Committed by Sebastian Reichel
Browse files

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: c8aee3f4 ("power: supply: Static data for Samsung batteries")
Signed-off-by: default avatarYassine Oudjana <y.oudjana@protonmail.com>
Reviewed-by: default avatarLinus Walleij <linus.walleij@linaro.org>
Signed-off-by: default avatarSebastian Reichel <sebastian.reichel@collabora.com>
parent 5c7d28c6
Loading
Loading
Loading
Loading
+6 −0
Original line number Original line Diff line number Diff line
@@ -604,6 +604,12 @@ int power_supply_get_battery_info(struct power_supply *psy,
	err = samsung_sdi_battery_get_info(&psy->dev, value, &info);
	err = samsung_sdi_battery_get_info(&psy->dev, value, &info);
	if (!err)
	if (!err)
		goto out_ret_pointer;
		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)) {
	if (strcmp("simple-battery", value)) {
		err = -ENODEV;
		err = -ENODEV;