Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 096fc160 authored by Christophe JAILLET's avatar Christophe JAILLET Committed by Sebastian Reichel
Browse files

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: default avatarChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: default avatarSebastian Reichel <sebastian.reichel@collabora.co.uk>
parent 46cecd13
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -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);
	}