提交 6f37b1b4 编写于 作者: A Axel Lin 提交者: Linus Walleij

pinctrl: spear: Make get_gpio_pingroup return NULL when no gpio_pingroup found

Currently get_gpio_pingroup() may return NULL or ERR_PTR(-EINVAL) when
no gpio_pingroup found. The caller in gpio_request_endisable() only
checks if the return value is NULL. Return ERR_PTR(-EINVAL) for
get_gpio_pingroup() causes problem and seems not necessary.
Signed-off-by: NAxel Lin <axel.lin@ingics.com>
Acked-by: NViresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
上级 80357203
...@@ -286,12 +286,12 @@ static struct spear_gpio_pingroup *get_gpio_pingroup(struct spear_pmx *pmx, ...@@ -286,12 +286,12 @@ static struct spear_gpio_pingroup *get_gpio_pingroup(struct spear_pmx *pmx,
unsigned pin) unsigned pin)
{ {
struct spear_gpio_pingroup *gpio_pingroup; struct spear_gpio_pingroup *gpio_pingroup;
int i = 0, j; int i, j;
if (!pmx->machdata->gpio_pingroups) if (!pmx->machdata->gpio_pingroups)
return NULL; return NULL;
for (; i < pmx->machdata->ngpio_pingroups; i++) { for (i = 0; i < pmx->machdata->ngpio_pingroups; i++) {
gpio_pingroup = &pmx->machdata->gpio_pingroups[i]; gpio_pingroup = &pmx->machdata->gpio_pingroups[i];
for (j = 0; j < gpio_pingroup->npins; j++) { for (j = 0; j < gpio_pingroup->npins; j++) {
...@@ -300,7 +300,7 @@ static struct spear_gpio_pingroup *get_gpio_pingroup(struct spear_pmx *pmx, ...@@ -300,7 +300,7 @@ static struct spear_gpio_pingroup *get_gpio_pingroup(struct spear_pmx *pmx,
} }
} }
return ERR_PTR(-EINVAL); return NULL;
} }
static int gpio_request_endisable(struct pinctrl_dev *pctldev, static int gpio_request_endisable(struct pinctrl_dev *pctldev,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册