Staging: speakup: replacing simple_strtoul with kstrtoul
authorAshvini Varatharaj <ashvinivaratharaj@gmail.com>
Sat, 19 Oct 2013 15:28:26 +0000 (20:58 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 19 Oct 2013 21:51:06 +0000 (14:51 -0700)
Fix checkpatch warning: WARNING: simple_strtoul is obsolete, use
kstrtoul instead

Signed-off-by: Ashvini Varatharaj <ashvinivaratharaj@gmail.com>
Reviewed-by: Peter P Waskiewicz Jr <peter.p.waskiewicz.jr@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/speakup/kobjects.c

index f31afa2cffb71597df483615730c6a0e92fffdd6..e2f597ee6261cb143e0f02ef05558734d24e2631 100644 (file)
@@ -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",