summaryrefslogtreecommitdiffstats
path: root/drivers/power
diff options
context:
space:
mode:
authorYassine Oudjana <y.oudjana@protonmail.com>2022-03-29 05:34:03 +0200
committerSebastian Reichel <sre@kernel.org>2022-04-13 12:05:22 +0200
commit581045ed5cfa42ed7f5364d6ccbcb6fcc077ffcf (patch)
tree247ca6778f0e8338ec6d49ef7992dc74936381f2 /drivers/power
parentpower: supply: samsung-sdi-battery: Add missing charge restart voltages (diff)
downloadlinux-581045ed5cfa42ed7f5364d6ccbcb6fcc077ffcf.tar.xz
linux-581045ed5cfa42ed7f5364d6ccbcb6fcc077ffcf.zip
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: c8aee3f41cb8 ("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>
Diffstat (limited to 'drivers/power')
-rw-r--r--drivers/power/supply/power_supply_core.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/power/supply/power_supply_core.c b/drivers/power/supply/power_supply_core.c
index ea02c8dcd748..d925cb137e12 100644
--- a/drivers/power/supply/power_supply_core.c
+++ b/drivers/power/supply/power_supply_core.c
@@ -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;