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)
|
void led_trigger_unregister_simple(struct led_trigger *trigger)
|
||||||
{
|
{
|
||||||
led_trigger_unregister(trigger);
|
if (trigger)
|
||||||
|
led_trigger_unregister(trigger);
|
||||||
kfree(trigger);
|
kfree(trigger);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue