Re: [PATCH 27/33] sched/debug: use match_string() helper

Andy Shevchenko
2018-05-22T20:29:23Z

On Tue, May 22, 2018 at 3:10 PM, Yisheng Xie <xieyisheng1@huawei.com> wrote:

>>> + i = match_string(sched_feat_names, __SCHED_FEAT_NR, cmp);
>>> + if (i >= 0) {
>>
>> Why not
>>
>> if (i < 0)
>> return i;
>
> if i >=0 it will also return i. so need return i just if (i < 0), right ?

Looking to the only (modified) caller, I think yes, either you return
error code or just 0.

>>> - if (i == __SCHED_FEAT_NR)
>>> + if (i < 0)
>>> return -EINVAL;
>>
>> Now it would be
>>

>> if (i < 0)

...even if (i) and rename i to ret to show the change in returned value meaning.

>> return i;
>
> Right, will change it in next version

--
With Best Regards,
Andy Shevchenko