staging: lustre: Replace sscanf with kstrtoint
authorCristina Moraru <cristina.moraru09@gmail.com>
Mon, 26 Oct 2015 22:30:08 +0000 (00:30 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 27 Oct 2015 05:37:09 +0000 (14:37 +0900)
Replace single variable sscanf with specialized function
kstrtoint at the suggestion of checkpatch.pl, to fix
'WARNING: Prefer kstrto<type> to single variable sscanf'

Signed-off-by: Cristina Moraru <cristina.moraru09@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/lustre/lustre/lov/lov_obd.c

index 1d74d926d10298509dca6cb562e7782d576d935a..7abe484c07c043fa724146bccda6a69247ed7a17 100644 (file)
@@ -914,14 +914,12 @@ int lov_process_config_base(struct obd_device *obd, struct lustre_cfg *lcfg,
 
                obd_str2uuid(&obd_uuid,  lustre_cfg_buf(lcfg, 1));
 
-               if (sscanf(lustre_cfg_buf(lcfg, 2), "%d", indexp) != 1) {
-                       rc = -EINVAL;
+               rc = kstrtoint(lustre_cfg_buf(lcfg, 2), 10, indexp);
+               if (rc < 0)
                        goto out;
-               }
-               if (sscanf(lustre_cfg_buf(lcfg, 3), "%d", genp) != 1) {
-                       rc = -EINVAL;
+               rc = kstrtoint(lustre_cfg_buf(lcfg, 3), 10, genp);
+               if (rc < 0)
                        goto out;
-               }
                index = *indexp;
                gen = *genp;
                if (cmd == LCFG_LOV_ADD_OBD)