Skip to content

Commit fbfa197

Browse files
jacek-anaszewskijanaszewski
authored andcommitted
leds: triggers: Return from led_trigger_set() if there is nothing to do
If led_trigger_set() is called with "trig" argument set to NULL, and there is no trigger to remove then the function should return immediately so as to avoid doing unnecessary allocation and sending uevent. Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com> Reported-by: Daniel Romell <daro@hms.se> Acked-by Daniel Romell <daro@hms.se>
1 parent 74b69e5 commit fbfa197

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

‎drivers/leds/led-triggers.c‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,9 @@ void led_trigger_set(struct led_classdev *led_cdev, struct led_trigger *trig)
110110
char *envp[2];
111111
const char *name;
112112

113+
if (!led_cdev->trigger && !trig)
114+
return;
115+
113116
name = trig ? trig->name : "none";
114117
event = kasprintf(GFP_KERNEL, "TRIGGER=%s", name);
115118

0 commit comments

Comments
 (0)