pinctrl: rockchip: Simplify for loop iteration
Just return once a match found makes the code simpler and shorter. Signed-off-by: Axel Lin <axel.lin@ingics.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
This commit is contained in:
parent
1ede12d491
commit
1cb9539587
@ -167,18 +167,14 @@ static const inline struct rockchip_pin_group *pinctrl_name_to_group(
|
|||||||
const struct rockchip_pinctrl *info,
|
const struct rockchip_pinctrl *info,
|
||||||
const char *name)
|
const char *name)
|
||||||
{
|
{
|
||||||
const struct rockchip_pin_group *grp = NULL;
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < info->ngroups; i++) {
|
for (i = 0; i < info->ngroups; i++) {
|
||||||
if (strcmp(info->groups[i].name, name))
|
if (!strcmp(info->groups[i].name, name))
|
||||||
continue;
|
return &info->groups[i];
|
||||||
|
|
||||||
grp = &info->groups[i];
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return grp;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -204,17 +200,12 @@ static struct rockchip_pin_bank *bank_num_to_bank(
|
|||||||
struct rockchip_pin_bank *b = info->ctrl->pin_banks;
|
struct rockchip_pin_bank *b = info->ctrl->pin_banks;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < info->ctrl->nr_banks; i++) {
|
for (i = 0; i < info->ctrl->nr_banks; i++, b++) {
|
||||||
if (b->bank_num == num)
|
if (b->bank_num == num)
|
||||||
break;
|
return b;
|
||||||
|
|
||||||
b++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (b->bank_num != num)
|
|
||||||
return ERR_PTR(-EINVAL);
|
return ERR_PTR(-EINVAL);
|
||||||
|
|
||||||
return b;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
Reference in New Issue
Block a user