Skip to content

Commit

Permalink
leds: triggers: Return from led_trigger_set() if there is nothing to do
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jacek Anaszewski authored and Jacek Anaszewski committed Sep 20, 2016
1 parent 74b69e5 commit fbfa197
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/leds/led-triggers.c
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,9 @@ void led_trigger_set(struct led_classdev *led_cdev, struct led_trigger *trig)
char *envp[2];
const char *name;

if (!led_cdev->trigger && !trig)
return;

name = trig ? trig->name : "none";
event = kasprintf(GFP_KERNEL, "TRIGGER=%s", name);

Expand Down

0 comments on commit fbfa197

Please sign in to comment.