提交 e7d02e3c 编写于 作者: M Mike Frysinger 提交者: Linus Torvalds

Blackfin SPI Driver: fix NULL pointer crash

Fix NULL pointer crash when cleaning up from invalid platform resources
Signed-off-by: NMike Frysinger <vapier.adi@gmail.com>
Signed-off-by: NBryan Wu <cooloney@kernel.org>
Cc: David Brownell <david-b@pacbell.net>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 138f97cd
...@@ -1178,6 +1178,9 @@ static void bfin_spi_cleanup(struct spi_device *spi) ...@@ -1178,6 +1178,9 @@ static void bfin_spi_cleanup(struct spi_device *spi)
{ {
struct chip_data *chip = spi_get_ctldata(spi); struct chip_data *chip = spi_get_ctldata(spi);
if (!chip)
return;
if ((chip->chip_select_num > 0) if ((chip->chip_select_num > 0)
&& (chip->chip_select_num <= spi->master->num_chipselect)) && (chip->chip_select_num <= spi->master->num_chipselect))
peripheral_free(ssel[spi->master->bus_num] peripheral_free(ssel[spi->master->bus_num]
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册