mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 11:41:38 -04:00
power: supply: charger-manager: Fix a NULL pointer dereference in 'charger_manager_probe()'
'devm_kzalloc()' can return NULL. Return -ENOMEM in this case in order to avoid a NULL pointer dereference later on. Signed-off-by: Christophe JAILLET <[email protected]> Signed-off-by: Sebastian Reichel <[email protected]>
This commit is contained in:
parent
46cecd130d
commit
096fc160b7
1 changed files with 2 additions and 0 deletions
|
|
@ -1645,6 +1645,8 @@ static int charger_manager_probe(struct platform_device *pdev)
|
|||
/* Initialize alarm timer */
|
||||
if (alarmtimer_get_rtcdev()) {
|
||||
cm_timer = devm_kzalloc(cm->dev, sizeof(*cm_timer), GFP_KERNEL);
|
||||
if (!cm_timer)
|
||||
return -ENOMEM;
|
||||
alarm_init(cm_timer, ALARM_BOOTTIME, cm_timer_func);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue