aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/leds/led-triggers.c
diff options
context:
space:
mode:
authorRichard Purdie <rpurdie@rpsys.net>2007-05-10 18:46:30 -0400
committerRichard Purdie <rpurdie@rpsys.net>2007-07-15 20:15:50 -0400
commit3593a6d64d774efb9d7ec80947607401ee6731c0 (patch)
tree5e1a05877dc385b9d74ef40c5168b567c54e70bd /drivers/leds/led-triggers.c
parent66242f7ec531953fbc2f4040c5ffe1f1ffe6c5c9 (diff)
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>
Diffstat (limited to 'drivers/leds/led-triggers.c')
-rw-r--r--drivers/leds/led-triggers.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/leds/led-triggers.c b/drivers/leds/led-triggers.c
index 454fb0901f82..129733f2379b 100644
--- a/drivers/leds/led-triggers.c
+++ b/drivers/leds/led-triggers.c
@@ -215,7 +215,8 @@ void led_trigger_unregister(struct led_trigger *trigger)
215 215
216void led_trigger_unregister_simple(struct led_trigger *trigger) 216void led_trigger_unregister_simple(struct led_trigger *trigger)
217{ 217{
218 led_trigger_unregister(trigger); 218 if (trigger)
219 led_trigger_unregister(trigger);
219 kfree(trigger); 220 kfree(trigger);
220} 221}
221 222