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: Kavya Nunna <knunna@codeaurora.org>
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user