[PATCH 4/7] gpiolib: return any error code from range creation

Subsystems: gpio subsystem, the rest

STALE5005d

3 messages, 3 authors, 2012-11-21 · open the first message on its own page

[PATCH 4/7] gpiolib: return any error code from range creation

From: Linus Walleij <hidden>
Date: 2012-11-20 14:05:13

From: Linus Walleij <redacted>

If we try to create a range for a certain GPIO chip and the
target pin controller is not yet available it may return
a probe deferral error code, so handle this all the way
our by checking the error code.

Signed-off-by: Linus Walleij <redacted>
---
 drivers/gpio/gpiolib.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index a59d13d..317ff04 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -1218,10 +1218,11 @@ int gpiochip_add_pin_range(struct gpio_chip *chip, const char *pinctl_name,
 	pin_range->range.npins = npins;
 	pin_range->pctldev = pinctrl_find_and_add_gpio_range(pinctl_name,
 			&pin_range->range);
-	if (!pin_range->pctldev) {
+	if (IS_ERR(pin_range->pctldev)) {
 		pr_err("%s: GPIO chip: could not create pin range\n",
 		       chip->label);
 		kfree(pin_range);
+		return PTR_ERR(pin_range->pctldev);
 	}
 	pr_debug("%s: GPIO chip: created GPIO range %d->%d ==> PIN %d->%d\n",
 		 chip->label, offset, offset + npins - 1,
-- 
1.7.11.3

Re: [PATCH 4/7] gpiolib: return any error code from range creation

From: Stephen Warren <hidden>
Date: 2012-11-20 17:28:52

On 11/20/2012 07:04 AM, Linus Walleij wrote:
From: Linus Walleij <redacted>

If we try to create a range for a certain GPIO chip and the
target pin controller is not yet available it may return
a probe deferral error code, so handle this all the way
our by checking the error code.
I think patches 3 and 4 need to be squashed together to avoid any "git
bisect" issues?

Re: [PATCH 4/7] gpiolib: return any error code from range creation

From: Linus Walleij <hidden>
Date: 2012-11-21 07:54:16

On Tue, Nov 20, 2012 at 6:28 PM, Stephen Warren [off-list ref] wrote:
On 11/20/2012 07:04 AM, Linus Walleij wrote:
quoted
From: Linus Walleij <redacted>

If we try to create a range for a certain GPIO chip and the
target pin controller is not yet available it may return
a probe deferral error code, so handle this all the way
our by checking the error code.
I think patches 3 and 4 need to be squashed together to avoid any "git
bisect" issues?
OK that's correct I'll fix...

Linus Walleij
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help