[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <53A9FF42.2090502@amd.com>
Date: Tue, 24 Jun 2014 17:44:18 -0500
From: Tom Lendacky <thomas.lendacky@....com>
To: Joe Perches <joe@...ches.com>
CC: <netdev@...r.kernel.org>, <davem@...emloft.net>
Subject: Re: [PATCH net-next 6/6] amd-xgbe: Resolve checkpatch warning about
sscanf usage
On 06/24/2014 05:00 PM, Joe Perches wrote:
> On Tue, 2014-06-24 at 16:19 -0500, Tom Lendacky wrote:
>> Checkpatch issued a warning preferring to use kstrto<type> when
>> using a single variable sscanf. Change the sscanf invocation to
>> a kstrtouint call.
> []
>> diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-debugfs.c b/drivers/net/ethernet/amd/xgbe/xgbe-debugfs.c
> []
>> @@ -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);
>
> Don't you need to use 16 for the base here?
Using 0 allows for greater flexibility in the input format.
>
>> + if (ret)
>> + return ret;
>
> Are there any issues with any of the various callers
> getting a different error return?
>
> -EINVAL/-ERANGE vs -EIO ?
>
There shouldn't be, but I can always return -EIO to be
consistent with how it was previously.
Tom
>
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists