power: supply: qcom_pmi8998_charger: fix uninitialized variable
authorYu Liao <liaoyu15@huawei.com>
Wed, 2 Aug 2023 02:31:30 +0000 (10:31 +0800)
committerSebastian Reichel <sebastian.reichel@collabora.com>
Thu, 3 Aug 2023 00:23:21 +0000 (02:23 +0200)
commit13a0d1088c8fea1565e30a169188b59bdd77759e
tree5f3081c18e1c4c11f332eeb72de6ef9ea7f23085
parentaf73fd32b4f2d23bb61c37f533ddae49e10ef3b0
power: supply: qcom_pmi8998_charger: fix uninitialized variable

smatch warnings:
  drivers/power/supply/qcom_pmi8998_charger.c:565 smb2_status_change_work() error: uninitialized symbol 'usb_online'.

usb_online is used uninitialized whenever smb2_get_prop_usb_online()
returns a negative value.

Thus, fix the issue by initializing usb_online to 0.

Fixes: 8648aeb5d7b7 ("power: supply: add Qualcomm PMI8998 SMB2 Charger driver")
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/r/202307280638.556PrzIS-lkp@intel.com/
Signed-off-by: Yu Liao <liaoyu15@huawei.com>
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org
Link: https://lore.kernel.org/r/20230802023130.2516232-1-liaoyu15@huawei.com
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
drivers/power/supply/qcom_pmi8998_charger.c