diff options
author | Hans de Goede <hdegoede@redhat.com> | 2016-12-14 17:38:50 +0100 |
---|---|---|
committer | Sebastian Reichel <sre@kernel.org> | 2017-01-04 21:59:08 +0100 |
commit | 6f074bc878dc9b00c0df0bf3a8cb1d9e294cd881 (patch) | |
tree | 808e014564adab1d9558d2ee62fa4b254def4865 /drivers | |
parent | 94c7073fe32a3254ac6bd3d194aa5ea230fed5c4 (diff) | |
download | linux-stable-6f074bc878dc9b00c0df0bf3a8cb1d9e294cd881.tar.gz linux-stable-6f074bc878dc9b00c0df0bf3a8cb1d9e294cd881.tar.bz2 linux-stable-6f074bc878dc9b00c0df0bf3a8cb1d9e294cd881.zip |
power: supply: axp288_fuel_gauge: Fix fuel_gauge_reg_readb return on error
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>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/power/supply/axp288_fuel_gauge.c | 4 |
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 539eb41504bb..86bb4d08b236 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; } |