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>
This commit is contained in:
Hans de Goede 2016-12-14 17:38:50 +01:00 committed by Sebastian Reichel
parent 94c7073fe3
commit 6f074bc878

View File

@ -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;
}