summaryrefslogtreecommitdiffstats
path: root/drivers/spi
diff options
context:
space:
mode:
authorDaniel Ribeiro <drwyrm@gmail.com>2009-05-12 22:19:36 +0200
committerLinus Torvalds <torvalds@linux-foundation.org>2009-05-12 23:11:34 +0200
commit7348d82a67b3fe0363e7f0679b50ecbdc65116c7 (patch)
treeed0f3029a4eaf8b2ec6149214f2191390ff2c377 /drivers/spi
parentMerge branch 'i2c-for-2630-rc5' of git://aeryn.fluff.org.uk/bjdooks/linux (diff)
downloadlinux-7348d82a67b3fe0363e7f0679b50ecbdc65116c7.tar.xz
linux-7348d82a67b3fe0363e7f0679b50ecbdc65116c7.zip
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>
Diffstat (limited to 'drivers/spi')
-rw-r--r--drivers/spi/pxa2xx_spi.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/spi/pxa2xx_spi.c b/drivers/spi/pxa2xx_spi.c
index 885194a07418..3f3c08c6ba4e 100644
--- a/drivers/spi/pxa2xx_spi.c
+++ b/drivers/spi/pxa2xx_spi.c
@@ -1373,6 +1373,9 @@ static void cleanup(struct spi_device *spi)
{
struct chip_data *chip = spi_get_ctldata(spi);
+ if (!chip)
+ return;
+
if (gpio_is_valid(chip->gpio_cs))
gpio_free(chip->gpio_cs);