Skip to content

Commit 66f95c3

Browse files
tlendackydavem330
authored andcommitted
amd-xgbe: Resolve checkpatch warning about sscanf usage
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 <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent b85e4d8 commit 66f95c3

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

drivers/net/ethernet/amd/xgbe/xgbe-debugfs.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ static ssize_t xgbe_common_write(const char __user *buffer, size_t count,
151151
{
152152
char workarea[32];
153153
ssize_t len;
154-
unsigned int scan_value;
154+
int ret;
155155

156156
if (*ppos != 0)
157157
return 0;
@@ -165,10 +165,9 @@ static ssize_t xgbe_common_write(const char __user *buffer, size_t count,
165165
return len;
166166

167167
workarea[len] = '\0';
168-
if (sscanf(workarea, "%x", &scan_value) == 1)
169-
*value = scan_value;
170-
else
171-
return -EIO;
168+
ret = kstrtouint(workarea, 0, value);
169+
if (ret)
170+
return ret;
172171

173172
return len;
174173
}

0 commit comments

Comments
 (0)