linux-stable/drivers/power
Tom Rix ca869971a9 power: supply: check if calc_soc succeeded in pm860x_init_battery
[ Upstream commit ccf193dee1 ]

clang static analysis flags this error

88pm860x_battery.c:522:19: warning: Assigned value is
  garbage or undefined [core.uninitialized.Assign]
                info->start_soc = soc;
                                ^ ~~~
soc is set by calling calc_soc.
But calc_soc can return without setting soc.

So check the return status and bail similarly to other
checks in pm860x_init_battery and initialize soc to
silence the warning.

Fixes: a830d28b48 ("power_supply: Enable battery-charger for 88pm860x")

Signed-off-by: Tom Rix <trix@redhat.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-08-21 09:48:11 +02:00
..
avs
reset
supply power: supply: check if calc_soc succeeded in pm860x_init_battery 2020-08-21 09:48:11 +02:00
Kconfig
Makefile