]> git.karo-electronics.de Git - linux-beck.git/commitdiff
leds: triggers: return error if invalid trigger name is provided via sysfs
authorHeiner Kallweit <hkallweit1@gmail.com>
Fri, 1 Jul 2016 21:08:54 +0000 (23:08 +0200)
committerJacek Anaszewski <j.anaszewski@samsung.com>
Mon, 4 Jul 2016 06:51:37 +0000 (08:51 +0200)
If an invalid trigger name is provided via sysfs currently no error
is returned. Therefore it's not possible to determine whether the
trigger was set successfully.
Fix this by returning -EINVAL if no trigger is matched.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
drivers/leds/led-triggers.c

index 55fa65e1ae030dc2840d7d53e74975f4c6eaf311..c92702a684cedeaad3d2932772e62cf971c98037 100644 (file)
@@ -60,6 +60,8 @@ ssize_t led_trigger_store(struct device *dev, struct device_attribute *attr,
                        goto unlock;
                }
        }
+       /* we come here only if buf matches no trigger */
+       ret = -EINVAL;
        up_read(&triggers_list_lock);
 
 unlock: