lkml.org 
[lkml]   [2022]   [May]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2 2/2] mm: Covert sysfs input to bool using kstrtobool()
On Wed, Apr 27, 2022 at 06:17:29PM +0300, Andy Shevchenko wrote:
> On Tue, Apr 26, 2022 at 10:30:40PM +0530, Jagdish Gediya wrote:
> > Sysfs input conversion to corrosponding bool value e.g. "false" or "0"
> > to false, "true" or "1" to true are currently handled through strncmp
> > at multiple places. Use kstrtobool() to convert sysfs input to bool
> > value.
>
> ...
>
> > + if (kstrtobool(buf, &numa_demotion_enabled))
> > return -EINVAL;
>
> Hmm... The commit message doesn't explain what's wrong with the error codes
> returned by kstrtobool(). Can't it be
>
> ret = kstrtobool();
> if (ret)
> return ret;
>
> ?
Sorry for the late reply, I was away from work for few days. Yes, It can
be like what you mentioned.
> ...
>
> > + if (kstrtobool(buf, &enable_vma_readahead))
> > return -EINVAL;
>
> Ditto.
>
> --
> With Best Regards,
> Andy Shevchenko
>
>
>

\
 
 \ /
  Last update: 2022-05-16 12:50    [W:0.501 / U:0.212 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site