From: Richard Purdie Date: Thu, 10 May 2007 22:46:30 +0000 (+0100) Subject: leds: Fix trigger unregister_simple if register_simple fails X-Git-Tag: v2.6.23-rc1~9^2~3 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3593a6d64d774efb9d7ec80947607401ee6731c0;p=linux-2.6 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 --- diff --git a/drivers/leds/led-triggers.c b/drivers/leds/led-triggers.c index 454fb0901f..129733f237 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) void led_trigger_unregister_simple(struct led_trigger *trigger) { - led_trigger_unregister(trigger); + if (trigger) + led_trigger_unregister(trigger); kfree(trigger); }