From e7d02e3c9577f070bc77354763bed7f24713dc53 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Mon, 6 Apr 2009 19:00:51 -0700 Subject: [PATCH] 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 --- drivers/spi/spi_bfin5xx.c | 3 +++ 1 file changed, 3 insertions(+) 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] -- 2.20.1