All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] pinctrl: spear: Make get_gpio_pingroup return NULL when no gpio_pingroup found
@ 2012-11-13 12:20 Axel Lin
  2012-11-15 11:32 ` Linus Walleij
  0 siblings, 1 reply; 2+ messages in thread
From: Axel Lin @ 2012-11-13 12:20 UTC (permalink / raw)
  To: Linus Walleij; +Cc: Viresh Kumar, spear-devel, linux-kernel

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: Axel Lin <axel.lin@ingics.com>
---
 drivers/pinctrl/spear/pinctrl-spear.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/pinctrl/spear/pinctrl-spear.c b/drivers/pinctrl/spear/pinctrl-spear.c
index 107780c..42bc267 100644
--- a/drivers/pinctrl/spear/pinctrl-spear.c
+++ b/drivers/pinctrl/spear/pinctrl-spear.c
@@ -284,12 +284,12 @@ static struct spear_gpio_pingroup *get_gpio_pingroup(struct spear_pmx *pmx,
 		unsigned pin)
 {
 	struct spear_gpio_pingroup *gpio_pingroup;
-	int i = 0, j;
+	int i, j;
 
 	if (!pmx->machdata->gpio_pingroups)
 		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];
 
 		for (j = 0; j < gpio_pingroup->npins; j++) {
@@ -298,7 +298,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,
-- 
1.7.9.5




^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] pinctrl: spear: Make get_gpio_pingroup return NULL when no gpio_pingroup found
  2012-11-13 12:20 [PATCH] pinctrl: spear: Make get_gpio_pingroup return NULL when no gpio_pingroup found Axel Lin
@ 2012-11-15 11:32 ` Linus Walleij
  0 siblings, 0 replies; 2+ messages in thread
From: Linus Walleij @ 2012-11-15 11:32 UTC (permalink / raw)
  To: Axel Lin; +Cc: Viresh Kumar, spear-devel, linux-kernel

On Tue, Nov 13, 2012 at 1:20 PM, Axel Lin <axel.lin@ingics.com> wrote:

> 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: Axel Lin <axel.lin@ingics.com>

Applied with Viresh's ACK.

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-11-15 11:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-13 12:20 [PATCH] pinctrl: spear: Make get_gpio_pingroup return NULL when no gpio_pingroup found Axel Lin
2012-11-15 11:32 ` Linus Walleij

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.