From: Saurabh Sengar <saurabh.truth@gmail.com>
To: dan.carpenter@oracle.com, devel@driverdev.osuosl.org,
kirk@reisers.ca, gregkh@linuxfoundation.org,
speakup@linux-speakup.org, linux-kernel@vger.kernel.org,
samuel.thibault@ens-lyon.com, chris@the-brannons.com
Cc: Saurabh Sengar <saurabh.truth@gmail.com>
Subject: [PATCH v2] Staging: speakup: kobjects: Return the error type to caller
Date: Mon, 7 Dec 2015 15:29:58 +0530 [thread overview]
Message-ID: <1449482398-9435-1-git-send-email-saurabh.truth@gmail.com> (raw)
In-Reply-To: <20151207083109.GC18797@mwanda>
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>
---
v2:
Hi Dan,
I will look more into this function in my free time.
For now just sending you this patch fixing ERANGE as commented
drivers/staging/speakup/kobjects.c | 4 +++-
drivers/staging/staging.c | 4 ++--
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/drivers/staging/speakup/kobjects.c b/drivers/staging/speakup/kobjects.c
index fdfeb42..509163c 100644
--- a/drivers/staging/speakup/kobjects.c
+++ b/drivers/staging/speakup/kobjects.c
@@ -640,7 +640,7 @@ 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)
+ if (!kstrtol(cp, 10, &value))
ret = spk_set_num_var(value, param, len);
else
pr_warn("overflow or parsing error has occurred");
@@ -688,6 +688,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);
diff --git a/drivers/staging/staging.c b/drivers/staging/staging.c
index 233e589..36dd594 100644
--- a/drivers/staging/staging.c
+++ b/drivers/staging/staging.c
@@ -2,12 +2,12 @@
#include <linux/init.h>
#include <linux/module.h>
-static int __init staging_init(void)
+static int staging_init(void)
{
return 0;
}
-static void __exit staging_exit(void)
+static void staging_exit(void)
{
}
--
1.9.1
prev parent reply other threads:[~2015-12-07 10:00 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-04 14:42 [PATCH] " Saurabh Sengar
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 ` Saurabh Sengar [this message]
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=1449482398-9435-1-git-send-email-saurabh.truth@gmail.com \
--to=saurabh.truth@gmail.com \
--cc=chris@the-brannons.com \
--cc=dan.carpenter@oracle.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.com \
--cc=speakup@linux-speakup.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
Powered by JetHome