Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753973AbbLDOmw (ORCPT ); Fri, 4 Dec 2015 09:42:52 -0500 Received: from mail-pa0-f65.google.com ([209.85.220.65]:34028 "EHLO mail-pa0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752508AbbLDOms (ORCPT ); Fri, 4 Dec 2015 09:42:48 -0500 From: Saurabh Sengar 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 Subject: [PATCH] Staging: speakup: kobjects: Return the error type to caller Date: Fri, 4 Dec 2015 20:12:33 +0530 Message-Id: <1449240153-3927-1-git-send-email-saurabh.truth@gmail.com> X-Mailer: git-send-email 1.9.1 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1338 Lines: 39 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 --- 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/