forked from Minki/linux
led: triggers: Fix dereferencing of null pointer
Error was detected by PVS-Studio:
V522 Dereferencing of the null pointer 'led_cdev->trigger' might take place.
Fixes: 2282e125a4
("leds: triggers: let struct led_trigger::activate() return an error code")
Signed-off-by: Oleh Kravchenko <oleg@kaa.org.ua>
Reviewed-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>
This commit is contained in:
parent
ba7eb84f71
commit
4016ba8588
@ -167,11 +167,11 @@ err_add_groups:
|
||||
trig->deactivate(led_cdev);
|
||||
err_activate:
|
||||
|
||||
led_cdev->trigger = NULL;
|
||||
led_cdev->trigger_data = NULL;
|
||||
write_lock_irqsave(&led_cdev->trigger->leddev_list_lock, flags);
|
||||
list_del(&led_cdev->trig_list);
|
||||
write_unlock_irqrestore(&led_cdev->trigger->leddev_list_lock, flags);
|
||||
led_cdev->trigger = NULL;
|
||||
led_cdev->trigger_data = NULL;
|
||||
led_set_brightness(led_cdev, LED_OFF);
|
||||
kfree(event);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user