From: Mike Frysinger Date: Tue, 7 Apr 2009 02:00:51 +0000 (-0700) Subject: Blackfin SPI Driver: fix NULL pointer crash X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=e7d02e3c9577f070bc77354763bed7f24713dc53;p=GitHub%2Fexynos8895%2Fandroid_kernel_samsung_universal8895.git Blackfin SPI Driver: fix NULL pointer crash Fix NULL pointer crash when cleaning up from invalid platform resources Signed-off-by: Mike Frysinger Signed-off-by: Bryan Wu Cc: David Brownell Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/drivers/spi/spi_bfin5xx.c b/drivers/spi/spi_bfin5xx.c index d1ff34f3f6bd..53819c961a31 100644 --- a/drivers/spi/spi_bfin5xx.c +++ b/drivers/spi/spi_bfin5xx.c @@ -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]