summaryrefslogtreecommitdiff
path: root/drivers/power
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2016-12-14 19:38:50 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-10-08 11:26:03 +0300
commit36c56ac0f8977ac189d27a7aa401ea9dca678c5d (patch)
tree4eb059679c9d6499c0fac6d883b032c8f9f2c04a /drivers/power
parent0cde56d3b6721e8a69260861d268a8adcc6fcd33 (diff)
downloadlinux-36c56ac0f8977ac189d27a7aa401ea9dca678c5d.tar.xz
power: supply: axp288_fuel_gauge: Fix fuel_gauge_reg_readb return on error
[ Upstream commit 6f074bc878dc9b00c0df0bf3a8cb1d9e294cd881 ] If reading the register fails, return the actual error code, instead of the uninitialized val variable; Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Sebastian Reichel <sre@kernel.org> Signed-off-by: Sasha Levin <alexander.levin@verizon.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/power')
-rw-r--r--drivers/power/supply/axp288_fuel_gauge.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/power/supply/axp288_fuel_gauge.c b/drivers/power/supply/axp288_fuel_gauge.c
index 5bdde692f724..f62f9dfea984 100644
--- a/drivers/power/supply/axp288_fuel_gauge.c
+++ b/drivers/power/supply/axp288_fuel_gauge.c
@@ -169,8 +169,10 @@ static int fuel_gauge_reg_readb(struct axp288_fg_info *info, int reg)
break;
}
- if (ret < 0)
+ if (ret < 0) {
dev_err(&info->pdev->dev, "axp288 reg read err:%d\n", ret);
+ return ret;
+ }
return val;
}