All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] leds: triggers: return error if invalid trigger name is provided via sysfs
@ 2016-07-01 21:08 Heiner Kallweit
  2016-07-04  6:54 ` Jacek Anaszewski
  0 siblings, 1 reply; 2+ messages in thread
From: Heiner Kallweit @ 2016-07-01 21:08 UTC (permalink / raw)
  To: Jacek Anaszewski, linux-leds

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>
---
 drivers/leds/led-triggers.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/leds/led-triggers.c b/drivers/leds/led-triggers.c
index 55fa65e..c92702a 100644
--- a/drivers/leds/led-triggers.c
+++ b/drivers/leds/led-triggers.c
@@ -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:
-- 
2.9.0

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-07-04  6:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-01 21:08 [PATCH] leds: triggers: return error if invalid trigger name is provided via sysfs Heiner Kallweit
2016-07-04  6:54 ` Jacek Anaszewski

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.