]> git.openfabrics.org - ~emulex/infiniband.git/commitdiff
gpiolib: return any error code from range creation
authorLinus Walleij <linus.walleij@linaro.org>
Tue, 20 Nov 2012 13:56:25 +0000 (14:56 +0100)
committerLinus Walleij <linus.walleij@linaro.org>
Wed, 21 Nov 2012 07:55:11 +0000 (08:55 +0100)
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.

Reviewed-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/gpio/gpiolib.c

index a59d13d746c57ce744a4f0984ce08a048d28b074..317ff0440e29cc42380535c37e45c2e6d6b1db4c 100644 (file)
@@ -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,