Blackfin SPI Driver: fix NULL pointer crash
authorMike Frysinger <vapier.adi@gmail.com>
Tue, 7 Apr 2009 02:00:51 +0000 (19:00 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 7 Apr 2009 15:31:06 +0000 (08:31 -0700)
Fix NULL pointer crash when cleaning up from invalid platform resources

Signed-off-by: Mike Frysinger <vapier.adi@gmail.com>
Signed-off-by: Bryan Wu <cooloney@kernel.org>
Cc: David Brownell <david-b@pacbell.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
drivers/spi/spi_bfin5xx.c

index d1ff34f3f6bd309b8af6639b0f079b6237b000a8..53819c961a3160fbb3fcbcddf098f2f6a363c7da 100644 (file)
@@ -1178,6 +1178,9 @@ static void bfin_spi_cleanup(struct spi_device *spi)
 {
        struct chip_data *chip = spi_get_ctldata(spi);
 
+       if (!chip)
+               return;
+
        if ((chip->chip_select_num > 0)
                && (chip->chip_select_num <= spi->master->num_chipselect))
                peripheral_free(ssel[spi->master->bus_num]