Commit 700c6ea2 authored by Adam Nielsen's avatar Adam Nielsen Committed by Richard Purdie

leds: Prevent multiple LED triggers with the same name

Signed-off-by: default avatarAdam Nielsen <>
Signed-off-by: default avatarRichard Purdie <>
parent 17354bfe
......@@ -156,12 +156,20 @@ EXPORT_SYMBOL_GPL(led_trigger_set_default);
int led_trigger_register(struct led_trigger *trigger)
struct led_classdev *led_cdev;
struct led_trigger *trig;
/* Add to the list of led triggers */
/* Make sure the trigger's name isn't already in use */
list_for_each_entry(trig, &trigger_list, next_trig) {
if (!strcmp(trig->name, trigger->name)) {
return -EEXIST;
/* Add to the list of led triggers */
list_add_tail(&trigger->next_trig, &trigger_list);
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