]> err.no Git - linux-2.6/commitdiff
leds: Add warning printks in error paths
authorRichard Purdie <rpurdie@rpsys.net>
Thu, 10 May 2007 23:12:01 +0000 (00:12 +0100)
committerRichard Purdie <rpurdie@rpsys.net>
Mon, 16 Jul 2007 00:15:51 +0000 (01:15 +0100)
Add warning printks if led_trigger_register_simple() fails.

Signed-off-by: Richard Purdie <rpurdie@rpsys.net>
drivers/leds/led-triggers.c

index 129733f2379b06381f6257e257ae63b64ff0e049..b2438a03082b202aea480fcfddfa756fb8338df1 100644 (file)
@@ -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;
 }