From a8eecad5c906707475a2141133fe43710e5f5e85 Mon Sep 17 00:00:00 2001 From: Ashvini Varatharaj Date: Sat, 19 Oct 2013 20:58:26 +0530 Subject: [PATCH] Staging: speakup: replacing simple_strtoul with kstrtoul Fix checkpatch warning: WARNING: simple_strtoul is obsolete, use kstrtoul instead Signed-off-by: Ashvini Varatharaj Reviewed-by: Peter P Waskiewicz Jr Signed-off-by: Greg Kroah-Hartman --- drivers/staging/speakup/kobjects.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/staging/speakup/kobjects.c b/drivers/staging/speakup/kobjects.c index f31afa2cffb7..e2f597ee6261 100644 --- a/drivers/staging/speakup/kobjects.c +++ b/drivers/staging/speakup/kobjects.c @@ -616,7 +616,7 @@ ssize_t spk_var_store(struct kobject *kobj, struct kobj_attribute *attr, int len; char *cp; struct var_t *var_data; - int value; + long value; unsigned long flags; param = spk_var_header_by_name(attr->attr.name); @@ -638,8 +638,10 @@ ssize_t spk_var_store(struct kobject *kobj, struct kobj_attribute *attr, len = E_INC; else len = E_SET; - value = simple_strtol(cp, NULL, 10); - ret = spk_set_num_var(value, param, len); + if (kstrtol(cp, 10, &value) == 0) + ret = spk_set_num_var(value, param, len); + else + pr_warn("overflow or parsing error has occured"); if (ret == -ERANGE) { var_data = param->data; pr_warn("value for %s out of range, expect %d to %d\n", -- 2.39.5