Staging: lustre: use kstrtoul() instead of sscanf()
authoraybuke ozdemir <aybuke.147@gmail.com>
Sat, 21 Feb 2015 20:47:43 +0000 (22:47 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 26 Feb 2015 20:23:57 +0000 (12:23 -0800)
This patch makes checkpatch.pl by fixing the following warning:
WARNING: Prefer kstrto<type> to single variable sscanf.
I used to kstrtoul can convert unsigned long instead of sscanf

Signed-off-by: aybuke ozdemir <aybuke.147@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/lustre/lustre/llite/llite_lib.c

index a2b11ef89d912029eed2085367e1a924c81f98a1..4ebc28cf37dda6d617c6c33250c6c9a7219b9e53 100644 (file)
@@ -2151,7 +2151,8 @@ int ll_process_config(struct lustre_cfg *lcfg)
        ptr = strrchr(lustre_cfg_string(lcfg, 0), '-');
        if (!ptr || !*(++ptr))
                return -EINVAL;
-       if (sscanf(ptr, "%lx", &x) != 1)
+       rc = kstrtoul(ptr, 16, &x);
+       if (rc != 0)
                return -EINVAL;
        sb = (void *)x;
        /* This better be a real Lustre superblock! */