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>
This commit is contained in:
Jacek Anaszewski 2016-09-18 20:24:29 +02:00 коммит произвёл Jacek Anaszewski
Родитель 74b69e5246
Коммит fbfa197afd
1 изменённых файлов: 3 добавлений и 0 удалений

Просмотреть файл

@ -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);