From: Saurabh Sengar <saurabh.truth@gmail.com>
To: w.d.hubbs@gmail.com, chris@the-brannons.com, kirk@reisers.ca,
samuel.thibault@ens-lyon.org, gregkh@linuxfoundation.org,
speakup@linux-speakup.org, devel@driverdev.osuosl.org,
linux-kernel@vger.kernel.org
Cc: Saurabh Sengar <saurabh.truth@gmail.com>
Subject: [PATCH] Staging: speakup: kobjects: Return the error type to caller
Date: Fri, 4 Dec 2015 20:12:33 +0530 [thread overview]
Message-ID: <1449240153-3927-1-git-send-email-saurabh.truth@gmail.com> (raw)
Inorder to notify the user that value is not successfuly set in sys
entry, error should be returned from store function instead of count
Signed-off-by: Saurabh Sengar <saurabh.truth@gmail.com>
---
drivers/staging/speakup/kobjects.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/staging/speakup/kobjects.c b/drivers/staging/speakup/kobjects.c
index fdfeb42..b3a83fb 100644
--- a/drivers/staging/speakup/kobjects.c
+++ b/drivers/staging/speakup/kobjects.c
@@ -640,7 +640,8 @@ ssize_t spk_var_store(struct kobject *kobj, struct kobj_attribute *attr,
len = E_INC;
else
len = E_SET;
- if (kstrtol(cp, 10, &value) == 0)
+ ret = kstrtol(cp, 10, &value);
+ if (!ret)
ret = spk_set_num_var(value, param, len);
else
pr_warn("overflow or parsing error has occurred");
@@ -688,6 +689,8 @@ ssize_t spk_var_store(struct kobject *kobj, struct kobj_attribute *attr,
if (ret == -ERESTART)
pr_info("%s reset to default value\n", param->name);
+ else if (ret < 0)
+ return ret;
return count;
}
EXPORT_SYMBOL_GPL(spk_var_store);
--
1.9.1
next reply other threads:[~2015-12-04 14:42 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-04 14:42 Saurabh Sengar [this message]
2015-12-07 6:48 ` Dan Carpenter
2015-12-07 7:16 ` Saurabh Sengar
2015-12-07 8:31 ` Dan Carpenter
2015-12-07 9:59 ` [PATCH v2] " Saurabh Sengar
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=1449240153-3927-1-git-send-email-saurabh.truth@gmail.com \
--to=saurabh.truth@gmail.com \
--cc=chris@the-brannons.com \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@linuxfoundation.org \
--cc=kirk@reisers.ca \
--cc=linux-kernel@vger.kernel.org \
--cc=samuel.thibault@ens-lyon.org \
--cc=speakup@linux-speakup.org \
--cc=w.d.hubbs@gmail.com \
/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
all inboxes | Powered by JetHome®