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 <[email protected]> --- 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 [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/

