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:
Richard Purdie 2007-05-10 23:46:30 +01:00
parent 66242f7ec5
commit 3593a6d64d
1 changed files with 2 additions and 1 deletions

View File

@ -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);
}