aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpio/gpio-omap.c
diff options
context:
space:
mode:
authorJavier Martinez Canillas <javier.martinez@collabora.co.uk>2014-04-06 10:58:14 -0400
committerLinus Walleij <linus.walleij@linaro.org>2014-04-28 15:35:08 -0400
commit6ef7f385610a235c7041206da0f92f760b5d0e8d (patch)
tree6a55811e7bf5dfb6e374a53ebb22d759e9b64aed /drivers/gpio/gpio-omap.c
parentcaebd9db7677166994570db69210cdaa3e30e1fb (diff)
gpio: omap: check gpiochip_add() return value
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>
Diffstat (limited to 'drivers/gpio/gpio-omap.c')
-rw-r--r--drivers/gpio/gpio-omap.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c
index 3ee9b8d26f71..e71788835319 100644
--- a/drivers/gpio/gpio-omap.c
+++ b/drivers/gpio/gpio-omap.c
@@ -1081,10 +1081,11 @@ omap_mpuio_alloc_gc(struct gpio_bank *bank, unsigned int irq_start,
1081 IRQ_NOREQUEST | IRQ_NOPROBE, 0); 1081 IRQ_NOREQUEST | IRQ_NOPROBE, 0);
1082} 1082}
1083 1083
1084static void omap_gpio_chip_init(struct gpio_bank *bank) 1084static int omap_gpio_chip_init(struct gpio_bank *bank)
1085{ 1085{
1086 int j; 1086 int j;
1087 static int gpio; 1087 static int gpio;
1088 int ret;
1088 1089
1089 /* 1090 /*
1090 * REVISIT eventually switch from OMAP-specific gpio structs 1091 * REVISIT eventually switch from OMAP-specific gpio structs
@@ -1110,7 +1111,11 @@ static void omap_gpio_chip_init(struct gpio_bank *bank)
1110 } 1111 }
1111 bank->chip.ngpio = bank->width; 1112 bank->chip.ngpio = bank->width;
1112 1113
1113 gpiochip_add(&bank->chip); 1114 ret = gpiochip_add(&bank->chip);
1115 if (ret) {
1116 dev_err(bank->dev, "Could not register gpio chip\n", ret);
1117 return ret;
1118 }
1114 1119
1115 for (j = 0; j < bank->width; j++) { 1120 for (j = 0; j < bank->width; j++) {
1116 int irq = irq_create_mapping(bank->domain, j); 1121 int irq = irq_create_mapping(bank->domain, j);
@@ -1139,6 +1144,7 @@ static int omap_gpio_probe(struct platform_device *pdev)
1139 struct resource *res; 1144 struct resource *res;
1140 struct gpio_bank *bank; 1145 struct gpio_bank *bank;
1141 int irq_base = 0; 1146 int irq_base = 0;
1147 int ret;
1142 1148
1143 match = of_match_device(of_match_ptr(omap_gpio_match), dev); 1149 match = of_match_device(of_match_ptr(omap_gpio_match), dev);
1144 1150
@@ -1223,7 +1229,11 @@ static int omap_gpio_probe(struct platform_device *pdev)
1223 mpuio_init(bank); 1229 mpuio_init(bank);
1224 1230
1225 omap_gpio_mod_init(bank); 1231 omap_gpio_mod_init(bank);
1226 omap_gpio_chip_init(bank); 1232
1233 ret = omap_gpio_chip_init(bank);
1234 if (ret)
1235 return ret;
1236
1227 omap_gpio_show_rev(bank); 1237 omap_gpio_show_rev(bank);
1228 1238
1229 pm_runtime_put(bank->dev); 1239 pm_runtime_put(bank->dev);