aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpio/gpio-sta2x11.c
diff options
context:
space:
mode:
authorAlessandro Rubini <rubini@gnudd.com>2012-05-27 16:55:41 -0400
committerLinus Walleij <linus.walleij@linaro.org>2012-07-05 08:48:49 -0400
commit2e2070c85aa19f6c5bb3642a1429abf42f101e8d (patch)
tree453583479f2db4976391fa0138706c83e17f71d9 /drivers/gpio/gpio-sta2x11.c
parent6887a4131da3adaab011613776d865f4bcfb5678 (diff)
gpio-sta2x11: don't use pdata if null
If there is no platform data available, the driver shouldn't use the pointer or it will oops. Since things will mostly work nonetheless, (the BIOS may have set up the pins properly), I'd better not fail the probe even in this case. Signed-off-by: Alessandro Rubini <rubini@gnudd.com> Acked-by: Giancarlo Asnaghi <giancarlo.asnaghi@st.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/gpio/gpio-sta2x11.c')
-rw-r--r--drivers/gpio/gpio-sta2x11.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/gpio/gpio-sta2x11.c b/drivers/gpio/gpio-sta2x11.c
index 38416be8ba11..6064fb376e11 100644
--- a/drivers/gpio/gpio-sta2x11.c
+++ b/drivers/gpio/gpio-sta2x11.c
@@ -383,8 +383,9 @@ static int __devinit gsta_probe(struct platform_device *dev)
383 } 383 }
384 spin_lock_init(&chip->lock); 384 spin_lock_init(&chip->lock);
385 gsta_gpio_setup(chip); 385 gsta_gpio_setup(chip);
386 for (i = 0; i < GSTA_NR_GPIO; i++) 386 if (gpio_pdata)
387 gsta_set_config(chip, i, gpio_pdata->pinconfig[i]); 387 for (i = 0; i < GSTA_NR_GPIO; i++)
388 gsta_set_config(chip, i, gpio_pdata->pinconfig[i]);
388 389
389 /* 384 was used in previous code: be compatible for other drivers */ 390 /* 384 was used in previous code: be compatible for other drivers */
390 err = irq_alloc_descs(-1, 384, GSTA_NR_GPIO, NUMA_NO_NODE); 391 err = irq_alloc_descs(-1, 384, GSTA_NR_GPIO, NUMA_NO_NODE);