diff options
Diffstat (limited to 'drivers/leds')
-rw-r--r-- | drivers/leds/led-triggers.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/leds/led-triggers.c b/drivers/leds/led-triggers.c index 4bebae733349..6f1ff93d7cec 100644 --- a/drivers/leds/led-triggers.c +++ b/drivers/leds/led-triggers.c | |||
@@ -261,9 +261,12 @@ void led_trigger_register_simple(const char *name, struct led_trigger **tp) | |||
261 | if (trigger) { | 261 | if (trigger) { |
262 | trigger->name = name; | 262 | trigger->name = name; |
263 | err = led_trigger_register(trigger); | 263 | err = led_trigger_register(trigger); |
264 | if (err < 0) | 264 | if (err < 0) { |
265 | kfree(trigger); | ||
266 | trigger = NULL; | ||
265 | printk(KERN_WARNING "LED trigger %s failed to register" | 267 | printk(KERN_WARNING "LED trigger %s failed to register" |
266 | " (%d)\n", name, err); | 268 | " (%d)\n", name, err); |
269 | } | ||
267 | } else | 270 | } else |
268 | printk(KERN_WARNING "LED trigger %s failed to register" | 271 | printk(KERN_WARNING "LED trigger %s failed to register" |
269 | " (no memory)\n", name); | 272 | " (no memory)\n", name); |