kernel-fxtec-pro1x/drivers/power
Tom Rix 6b03a2a347 power: supply: check if calc_soc succeeded in pm860x_init_battery
[ Upstream commit ccf193dee1f0fff55b556928591f7818bac1b3b1 ]

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-19 08:14:59 +02:00
..
avs PM / AVS: SmartReflex: NULL check before some freeing functions is not needed 2019-12-05 09:20:02 +01:00
reset power: vexpress: add suppress_bind_attrs to true 2020-06-22 09:05:27 +02:00
supply power: supply: check if calc_soc succeeded in pm860x_init_battery 2020-08-19 08:14:59 +02:00
Kconfig power: move power supply drivers to power/supply 2016-08-11 01:11:03 +02:00
Makefile power: move power supply drivers to power/supply 2016-08-11 01:11:03 +02:00