Skip to contentSkip to conversation

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

PATCH In review Axel Lin 2 participants 2 messages Nov 13, 2012 – Nov 15, 2012

Subsystems (2)
lore
Share & tools
lore

Axel Lin

author
#0 lore raw

PATCH 1/1 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.

---
 drivers/pinctrl/spear/pinctrl-spear.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/pinctrl/spear/pinctrl-spear.c +3 -3
index 107780c..42bc267 100644
@@ -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,
Signature · 1 line
1.7.9.5
#1 lore raw
Quoted 6 lines · Axel Lin

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.

Applied with Viresh's ACK.

Yours,
Linus Walleij