Skip to content

Commit 13a0d10

Browse files
yuliao0214sre
authored andcommitted
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: 8648aeb ("power: supply: add Qualcomm PMI8998 SMB2 Charger driver") Reported-by: kernel test robot <[email protected]> Closes: https://lore.kernel.org/r/[email protected]/ Signed-off-by: Yu Liao <[email protected]> Reviewed-by: Caleb Connolly <[email protected] Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Sebastian Reichel <[email protected]>
1 parent af73fd3 commit 13a0d10

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/power/supply/qcom_pmi8998_charger.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -556,7 +556,8 @@ static int smb2_set_current_limit(struct smb2_chip *chip, unsigned int val)
556556
static void smb2_status_change_work(struct work_struct *work)
557557
{
558558
unsigned int charger_type, current_ua;
559-
int usb_online, count, rc;
559+
int usb_online = 0;
560+
int count, rc;
560561
struct smb2_chip *chip;
561562

562563
chip = container_of(work, struct smb2_chip, status_change_work.work);

0 commit comments

Comments
 (0)