leds: triggers: return error if invalid trigger name is provided via sysfs
PATCH 1/1 leds: triggers: return error if invalid trigger name is provided via sysfs
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 <[email protected]>
--- drivers/leds/led-triggers.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/leds/led-triggers.c +2 -0
@@ -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:
Signature · 1 line
2.9.0
Hi Heiner,
Quoted 16 lines · Heiner Kallweit
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-EINVALif no trigger is matched.Signed-off-by Heiner Kallweit <[email protected]>--- drivers/leds/led-triggers.c | 2 ++ 1 file changed, 2 insertions(+)drivers/leds/led-triggers.c +0
-0
drivers/leds/led-triggers.c ssize_t led_trigger_store(struct device *dev, struct device_attribute *attr, · line 67
Quoted 8 lines
drivers/leds/led-triggers.c +2
-0@@ -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:
Thanks for the patch. Applied.
Signature · 2 lines
Best regards, Jacek Anaszewski