mirror of
https://github.com/torvalds/linux.git
synced 2024-11-28 07:01:32 +00: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 <christophe.jaillet@wanadoo.fr> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
This commit is contained in:
parent
46cecd130d
commit
096fc160b7
@ -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 New Issue
Block a user