From: Richard Purdie Date: Thu, 10 May 2007 23:12:01 +0000 (+0100) Subject: leds: Add warning printks in error paths X-Git-Tag: v2.6.23-rc1~9^2~2 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e3986f6380558b84fef1e7ce7a29fed5bb090721;p=linux-2.6 leds: Add warning printks in error paths Add warning printks if led_trigger_register_simple() fails. Signed-off-by: Richard Purdie --- diff --git a/drivers/leds/led-triggers.c b/drivers/leds/led-triggers.c index 129733f237..b2438a0308 100644 --- a/drivers/leds/led-triggers.c +++ b/drivers/leds/led-triggers.c @@ -183,13 +183,20 @@ int led_trigger_register(struct led_trigger *trigger) void led_trigger_register_simple(const char *name, struct led_trigger **tp) { struct led_trigger *trigger; + int err; trigger = kzalloc(sizeof(struct led_trigger), GFP_KERNEL); if (trigger) { trigger->name = name; - led_trigger_register(trigger); - } + err = led_trigger_register(trigger); + if (err < 0) + printk(KERN_WARNING "LED trigger %s failed to register" + " (%d)\n", name, err); + } else + printk(KERN_WARNING "LED trigger %s failed to register" + " (no memory)\n", name); + *tp = trigger; }