]> err.no Git - linux-2.6/commitdiff
leds: Fix trigger unregister_simple if register_simple fails
authorRichard Purdie <rpurdie@rpsys.net>
Thu, 10 May 2007 22:46:30 +0000 (23:46 +0100)
committerRichard Purdie <rpurdie@rpsys.net>
Mon, 16 Jul 2007 00:15:50 +0000 (01:15 +0100)
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>
drivers/leds/led-triggers.c

index 454fb0901f8211dc31ec6b86e6edac5bec774286..129733f2379b06381f6257e257ae63b64ff0e049 100644 (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);
 }