Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754072AbbKYNnl (ORCPT ); Wed, 25 Nov 2015 08:43:41 -0500 Received: from mail-wm0-f54.google.com ([74.125.82.54]:34050 "EHLO mail-wm0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751403AbbKYNni (ORCPT ); Wed, 25 Nov 2015 08:43:38 -0500 From: LABBE Corentin To: minyard@acm.org, openipmi-developer@lists.sourceforge.net Cc: LABBE Corentin , linux-kernel@vger.kernel.org Subject: [PATCH 4/4] ipmi: replace simple_strtoul by kstrtox Date: Wed, 25 Nov 2015 14:43:25 +0100 Message-Id: <1448459006-6118-4-git-send-email-clabbe.montjoie@gmail.com> X-Mailer: git-send-email 2.4.10 In-Reply-To: <1448459006-6118-1-git-send-email-clabbe.montjoie@gmail.com> References: <1448459006-6118-1-git-send-email-clabbe.montjoie@gmail.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2821 Lines: 97 The simple_strtoul function is marked as obsolete. This patch replace it by kstrtoint/kstrtoul. This will simplify code, since some error case not handled by simple_strtoul are handled by kstrtox. Signed-off-by: LABBE Corentin --- drivers/char/ipmi/ipmi_si_intf.c | 15 ++++++++------- drivers/char/ipmi/ipmi_watchdog.c | 8 ++++---- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c index d1fc200..48bab38 100644 --- a/drivers/char/ipmi/ipmi_si_intf.c +++ b/drivers/char/ipmi/ipmi_si_intf.c @@ -1775,17 +1775,17 @@ static int parse_str(const struct hotmod_vals *v, int *val, char *name, static int check_hotmod_int_op(const char *curr, const char *option, const char *name, int *val) { - char *n; + int err; if (strcmp(curr, name) == 0) { if (!option) { pr_warn(PFX "No option given for '%s'\n", curr); return -EINVAL; } - *val = simple_strtoul(option, &n, 0); - if ((*n != '\0') || (*option == '\0')) { + err = kstrtoint(option, 0, val); + if (err) { pr_warn(PFX "Bad option given for '%s'\n", curr); - return -EINVAL; + return err; } return 1; } @@ -1805,7 +1805,7 @@ static int hotmod_handler(const char *val, struct kernel_param *kp) { char *str = kstrdup(val, GFP_KERNEL); int rv; - char *next, *curr, *s, *n, *o; + char *next, *curr, *s, *o; enum hotmod_op op; enum si_type si_type; int addr_space; @@ -1817,6 +1817,7 @@ static int hotmod_handler(const char *val, struct kernel_param *kp) int ipmb; int ival; int len; + int err; struct smi_info *info; if (!str) @@ -1862,8 +1863,8 @@ static int hotmod_handler(const char *val, struct kernel_param *kp) *s = '\0'; s++; } - addr = simple_strtoul(curr, &n, 0); - if ((*n != '\0') || (*curr == '\0')) { + err = kstrtoul(curr, 0, &addr); + if (err) { pr_warn(PFX "Invalid hotmod address '%s'\n", curr); break; } diff --git a/drivers/char/ipmi/ipmi_watchdog.c b/drivers/char/ipmi/ipmi_watchdog.c index 096f0ce..2f0d2c4 100644 --- a/drivers/char/ipmi/ipmi_watchdog.c +++ b/drivers/char/ipmi/ipmi_watchdog.c @@ -194,15 +194,15 @@ static int start_now; static int set_param_timeout(const char *val, const struct kernel_param *kp) { - char *endp; + int err; int l; int rv = 0; if (!val) return -EINVAL; - l = simple_strtoul(val, &endp, 0); - if (endp == val) - return -EINVAL; + err = kstrtoint(val, 0, &l); + if (err) + return err; *((int *)kp->arg) = l; if (watchdog_user) -- 2.4.10 -- 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/