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

Commit 5e2a583c authored by Kavya Nunna's avatar Kavya Nunna
Browse files

leds: qpnp-flash-common: Fix possible null pointer dereference



Currently, there is no null check before using led_cdev.
Add a NULL pointer check before dereferencing it.

Change-Id: I4121be7511c299abbbda4de4de90f9d0a9168e15
Signed-off-by: default avatarKavya Nunna <knunna@codeaurora.org>
parent 82e0a0f5
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -39,6 +39,9 @@ int qpnp_flash_led_prepare(struct led_trigger *trig, int options,
	int rc = -ENODEV;

	led_cdev = trigger_to_lcdev(trig);
	if (!led_cdev)
		return rc;

	list_for_each_entry(flash_data, &flash_common_data, link) {
		if (led_cdev->dev->parent == flash_data->dev)
			rc = flash_data->func(trig, options, max_current);