lkml.org 
[lkml]   [2018]   [May]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH 05/33] cxgb4: use match_string() helper
On Mon, May 21, 2018 at 2:57 PM, Yisheng Xie <xieyisheng1@huawei.com> wrote:
> match_string() returns the index of an array for a matching string,
> which can be used intead of open coded variant.

> - for (i = 0; i < ARRAY_SIZE(cudbg_region); i++) {
> - if (!strcmp(cudbg_region[i], region_name)) {
> - found = 1;
> - idx = i;
> - break;
> - }
> - }
> - if (!found)
> - return -EINVAL;
> + rc = match_string(cudbg_region, ARRAY_SIZE(cudbg_region), region_name);
> + if (rc < 0)
> + return rc;
>
> - found = 0;
> + idx = rc;

Is found still in use after this?
If so, is it initialized properly now?

--
With Best Regards,
Andy Shevchenko

\
 
 \ /
  Last update: 2018-05-21 23:40    [W:0.719 / U:2.072 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site