Skip to content

Commit 2e2070c

Browse files
rubinilinusw
authored andcommitted
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 <[email protected]> Acked-by: Giancarlo Asnaghi <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
1 parent 6887a41 commit 2e2070c

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

drivers/gpio/gpio-sta2x11.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -383,8 +383,9 @@ static int __devinit gsta_probe(struct platform_device *dev)
383383
}
384384
spin_lock_init(&chip->lock);
385385
gsta_gpio_setup(chip);
386-
for (i = 0; i < GSTA_NR_GPIO; i++)
387-
gsta_set_config(chip, i, gpio_pdata->pinconfig[i]);
386+
if (gpio_pdata)
387+
for (i = 0; i < GSTA_NR_GPIO; i++)
388+
gsta_set_config(chip, i, gpio_pdata->pinconfig[i]);
388389

389390
/* 384 was used in previous code: be compatible for other drivers */
390391
err = irq_alloc_descs(-1, 384, GSTA_NR_GPIO, NUMA_NO_NODE);

0 commit comments

Comments
 (0)