smb1351-charger: Fix possible Null pointer dereference
The adc notification callback assumes that it will end up selecting the correct state. However, if the parameters are outside the expected values, the code could end up dereferencing a null pointer. Fix this by returning before that pointer is dereferenced. Change-Id: I42642b475a1032c3a7395336381f3bd6c1396dde Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
This commit is contained in:
parent
9b82a4c589
commit
bc2dcbfae6
1 changed files with 7 additions and 1 deletions
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (c) 2015 The Linux Foundation. All rights reserved.
|
||||
/* Copyright (c) 2016 The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 and
|
||||
|
@ -1872,6 +1872,12 @@ static void smb1351_chg_adc_notification(enum qpnp_tm_state state, void *ctx)
|
|||
}
|
||||
}
|
||||
|
||||
if (!cur) {
|
||||
pr_debug("Couldn't choose batt state, adc state=%d and temp=%d\n",
|
||||
state, temp);
|
||||
return;
|
||||
}
|
||||
|
||||
if (cur->batt_present)
|
||||
chip->battery_missing = false;
|
||||
else
|
||||
|
|
Loading…
Add table
Reference in a new issue