The gpiochip_add() function can fail if the chip cannot
be registered so the return value has to be checked and
the error propagated in case it happens.
Signed-off-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk>
Acked-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
Tested-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
IRQ_NOREQUEST | IRQ_NOPROBE, 0);
}
IRQ_NOREQUEST | IRQ_NOPROBE, 0);
}
-static void omap_gpio_chip_init(struct gpio_bank *bank)
+static int omap_gpio_chip_init(struct gpio_bank *bank)
{
int j;
static int gpio;
{
int j;
static int gpio;
/*
* REVISIT eventually switch from OMAP-specific gpio structs
/*
* REVISIT eventually switch from OMAP-specific gpio structs
}
bank->chip.ngpio = bank->width;
}
bank->chip.ngpio = bank->width;
- gpiochip_add(&bank->chip);
+ ret = gpiochip_add(&bank->chip);
+ if (ret) {
+ dev_err(bank->dev, "Could not register gpio chip\n", ret);
+ return ret;
+ }
for (j = 0; j < bank->width; j++) {
int irq = irq_create_mapping(bank->domain, j);
for (j = 0; j < bank->width; j++) {
int irq = irq_create_mapping(bank->domain, j);
struct resource *res;
struct gpio_bank *bank;
int irq_base = 0;
struct resource *res;
struct gpio_bank *bank;
int irq_base = 0;
match = of_match_device(of_match_ptr(omap_gpio_match), dev);
match = of_match_device(of_match_ptr(omap_gpio_match), dev);
mpuio_init(bank);
omap_gpio_mod_init(bank);
mpuio_init(bank);
omap_gpio_mod_init(bank);
- omap_gpio_chip_init(bank);
+
+ ret = omap_gpio_chip_init(bank);
+ if (ret)
+ return ret;
+
omap_gpio_show_rev(bank);
pm_runtime_put(bank->dev);
omap_gpio_show_rev(bank);
pm_runtime_put(bank->dev);