Re: [RFC 1/1 linux-next] gfs2: convert simple_str to kstr

From: Alexey Dobriyan
Date: Thu Apr 30 2015 - 06:54:56 EST


[cc linux-kernel]

On Thu, Apr 30, 2015 at 1:53 PM, Alexey Dobriyan <adobriyan@xxxxxxxxx> wrote:
>> By default I used destination type as a reference. Maybe it's wrong and
>> we really want to read long, unsigned long from source ?
>
> long and unsigned long -- no. Always look at type of data.
> There are many places where unsigned long is needlessly
> used because there is no simple_strtoint().
>
> Your patch is OK except block_store() wdack_store() chunks:
>
>> @@ static ssize_t block_store(struct gfs2_sbd *sdp, const char *buf, size_t len)
>> ssize_t ret = len;
>> - int val;
>> + int val, error;
>
> There is no need to add second "error" variable and
> there is no need for it to be ssize_t:
>
> int ret;
>
> ret = kstrtoint();
> if (ret < 0)
> return ret;
> if (val == 1)
> ...
> else if (val == 0)
> ...
> else
> return -EINVAL;
> return len;
>
> Overall, this code is exactly code kstrto*() was designed for.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/