Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

pxa2xx_spi: prevent panic case setup() fails

setup() may fail before ctldata is set, causing a kernel panic on
cleanup().

Signed-off-by: Daniel Ribeiro <drwyrm@gmail.com>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Cc: Eric Miao <eric.y.miao@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Daniel Ribeiro and committed by
Linus Torvalds
7348d82a 816dc3c8

+3
+3
drivers/spi/pxa2xx_spi.c
··· 1373 1373 { 1374 1374 struct chip_data *chip = spi_get_ctldata(spi); 1375 1375 1376 + if (!chip) 1377 + return; 1378 + 1376 1379 if (gpio_is_valid(chip->gpio_cs)) 1377 1380 gpio_free(chip->gpio_cs); 1378 1381