]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
pxa2xx_spi: prevent panic case setup() fails
authorDaniel Ribeiro <drwyrm@gmail.com>
Tue, 12 May 2009 20:19:36 +0000 (13:19 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 12 May 2009 21:11:34 +0000 (14:11 -0700)
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>
drivers/spi/pxa2xx_spi.c

index 885194a07418f85e94f733b3ecf2953d11d0e4ce..3f3c08c6ba4e1c60ce2305b7a0fe0247d5151fb8 100644 (file)
@@ -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);