diff options
author | Oleh Kravchenko <oleg@kaa.org.ua> | 2019-09-03 23:18:19 +0200 |
---|---|---|
committer | Jacek Anaszewski <jacek.anaszewski@gmail.com> | 2019-09-05 22:32:45 +0200 |
commit | 4016ba85880b252365d11bc7dc899450f2c73ad7 (patch) | |
tree | 166da76915831a255a43ea740cc192d24b4a6642 /drivers/leds | |
parent | leds: ti-lmu-common: Move static keyword to the front of declaration (diff) | |
download | linux-4016ba85880b252365d11bc7dc899450f2c73ad7.tar.xz linux-4016ba85880b252365d11bc7dc899450f2c73ad7.zip |
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: 2282e125a406 ("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>
Diffstat (limited to 'drivers/leds')
-rw-r--r-- | drivers/leds/led-triggers.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/leds/led-triggers.c b/drivers/leds/led-triggers.c index eff1bda8b520..23963e5cb5d6 100644 --- a/drivers/leds/led-triggers.c +++ b/drivers/leds/led-triggers.c @@ -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); |