summaryrefslogtreecommitdiff
path: root/drivers/leds/led-triggers.c
diff options
context:
space:
mode:
authorJacek Anaszewski <jacek.anaszewski@gmail.com>2016-09-18 18:24:29 (GMT)
committerJacek Anaszewski <j.anaszewski@samsung.com>2016-09-20 08:21:17 (GMT)
commitfbfa197afddd13f9bdca1c822f5d5730b50639eb (patch)
treeed9e17d37ba0a47a009f9ba71cc701373e68cf0d /drivers/leds/led-triggers.c
parent74b69e5246d13840963b7b23e21dbab541cb26d2 (diff)
downloadlinux-fbfa197afddd13f9bdca1c822f5d5730b50639eb.tar.xz
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>
Diffstat (limited to 'drivers/leds/led-triggers.c')
-rw-r--r--drivers/leds/led-triggers.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/leds/led-triggers.c b/drivers/leds/led-triggers.c
index 59d6a3e..c7a38d4 100644
--- a/drivers/leds/led-triggers.c
+++ b/drivers/leds/led-triggers.c
@@ -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);