Linux LED subsystem development
 help / color / mirror / Atom feed
From: Heiner Kallweit <hkallweit1@gmail.com>
To: Jacek Anaszewski <j.anaszewski@samsung.com>,
	"linux-leds@vger.kernel.org" <linux-leds@vger.kernel.org>
Subject: [PATCH] leds: triggers: return error if invalid trigger name is provided via sysfs
Date: Fri, 1 Jul 2016 23:08:54 +0200	[thread overview]
Message-ID: <d7ef6332-73ae-b902-bdf2-d6dbcf8cc06c@gmail.com> (raw)

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

             reply	other threads:[~2016-07-01 21:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-01 21:08 Heiner Kallweit [this message]
2016-07-04  6:54 ` [PATCH] leds: triggers: return error if invalid trigger name is provided via sysfs Jacek Anaszewski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d7ef6332-73ae-b902-bdf2-d6dbcf8cc06c@gmail.com \
    --to=hkallweit1@gmail.com \
    --cc=j.anaszewski@samsung.com \
    --cc=linux-leds@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox