summaryrefslogtreecommitdiff
path: root/drivers/leds/led-triggers.c
diff options
context:
space:
mode:
authorRichard Purdie <rpurdie@rpsys.net>2007-05-11 03:12:01 +0400
committerRichard Purdie <rpurdie@rpsys.net>2007-07-16 04:15:51 +0400
commite3986f6380558b84fef1e7ce7a29fed5bb090721 (patch)
treec23ac0c0a2202fddbbdbaeca608237d6d294304c /drivers/leds/led-triggers.c
parent3593a6d64d774efb9d7ec80947607401ee6731c0 (diff)
downloadlinux-e3986f6380558b84fef1e7ce7a29fed5bb090721.tar.xz
leds: Add warning printks in error paths
Add warning printks if led_trigger_register_simple() fails. Signed-off-by: Richard Purdie <rpurdie@rpsys.net>
Diffstat (limited to 'drivers/leds/led-triggers.c')
-rw-r--r--drivers/leds/led-triggers.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/drivers/leds/led-triggers.c b/drivers/leds/led-triggers.c
index 129733f2379b..b2438a03082b 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;
}