Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1283876

[PATCH] Staging: speakup: kobjects: Return the error type to caller

From Saurabh Sengar <saurabh.truth@gmail.com>
Newsgroups linux.kernel
Subject [PATCH] Staging: speakup: kobjects: Return the error type to caller
Date 2015-12-04 15:50 +0100
Message-ID <qBZQm-3Yo-9@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View 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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH] Staging: speakup: kobjects: Return the error type to caller Saurabh Sengar <saurabh.truth@gmail.com> - 2015-12-04 15:50 +0100
  Re: [PATCH] Staging: speakup: kobjects: Return the error type to  caller Dan Carpenter <dan.carpenter@oracle.com> - 2015-12-07 07:50 +0100
    Re: [PATCH] Staging: speakup: kobjects: Return the error type to caller Saurabh Sengar <saurabh.truth@gmail.com> - 2015-12-07 08:20 +0100
      Re: [PATCH] Staging: speakup: kobjects: Return the error type to  caller Dan Carpenter <dan.carpenter@oracle.com> - 2015-12-07 09:40 +0100
        [PATCH v2] Staging: speakup: kobjects: Return the error type to caller Saurabh Sengar <saurabh.truth@gmail.com> - 2015-12-07 11:10 +0100

csiph-web