Skip to content

Commit

Permalink
amd-xgbe: Resolve checkpatch warning about sscanf usage
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Lendacky, Thomas authored and David S. Miller committed Jun 27, 2014
1 parent b85e4d8 commit 66f95c3
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions drivers/net/ethernet/amd/xgbe/xgbe-debugfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
}
Expand Down

0 comments on commit 66f95c3

Please sign in to comment.