amd-xgbe: Resolve checkpatch warning about sscanf usage
authorLendacky, Thomas <Thomas.Lendacky@amd.com>
Tue, 24 Jun 2014 21:19:35 +0000 (16:19 -0500)
committerDavid S. Miller <davem@davemloft.net>
Fri, 27 Jun 2014 00:14:04 +0000 (17:14 -0700)
Checkpatch issued a warning preferring to use kstrto<type> when
using a single variable sscanf.  Change the sscanf invocation to
a kstrtouint call.

Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/amd/xgbe/xgbe-debugfs.c

index 6bb76d5c817b593f7a34a11032d2579c86b2936c..81198587a6c6887e2a7d88ae23837a5d38573325 100644 (file)
@@ -151,7 +151,7 @@ static ssize_t xgbe_common_write(const char __user *buffer, size_t count,
 {
        char workarea[32];
        ssize_t len;
-       unsigned int scan_value;
+       int ret;
 
        if (*ppos != 0)
                return 0;
@@ -165,10 +165,9 @@ static ssize_t xgbe_common_write(const char __user *buffer, size_t count,
                return len;
 
        workarea[len] = '\0';
-       if (sscanf(workarea, "%x", &scan_value) == 1)
-               *value = scan_value;
-       else
-               return -EIO;
+       ret = kstrtouint(workarea, 0, value);
+       if (ret)
+               return ret;
 
        return len;
 }
This page took 0.025997 seconds and 5 git commands to generate.