mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-15 17:43:59 +00:00
leds: Fix trigger unregister_simple if register_simple fails
Fix led_trigger_unregister_simple to handle the case where led_trigger_register_simple fails, avoiding a NULL pointer dereference. Signed-off-by: Richard Purdie <rpurdie@rpsys.net>
This commit is contained in:
parent
66242f7ec5
commit
3593a6d64d
@ -215,7 +215,8 @@ void led_trigger_unregister(struct led_trigger *trigger)
|
||||
|
||||
void led_trigger_unregister_simple(struct led_trigger *trigger)
|
||||
{
|
||||
led_trigger_unregister(trigger);
|
||||
if (trigger)
|
||||
led_trigger_unregister(trigger);
|
||||
kfree(trigger);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user