Commit e3986f63 authored by Richard Purdie's avatar Richard Purdie

leds: Add warning printks in error paths

Add warning printks if led_trigger_register_simple() fails.
Signed-off-by: default avatarRichard Purdie <rpurdie@rpsys.net>
parent 3593a6d6
...@@ -183,13 +183,20 @@ int led_trigger_register(struct led_trigger *trigger) ...@@ -183,13 +183,20 @@ int led_trigger_register(struct led_trigger *trigger)
void led_trigger_register_simple(const char *name, struct led_trigger **tp) void led_trigger_register_simple(const char *name, struct led_trigger **tp)
{ {
struct led_trigger *trigger; struct led_trigger *trigger;
int err;
trigger = kzalloc(sizeof(struct led_trigger), GFP_KERNEL); trigger = kzalloc(sizeof(struct led_trigger), GFP_KERNEL);
if (trigger) { if (trigger) {
trigger->name = name; 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; *tp = trigger;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment