From: Bartosz Golaszewski Date: Fri, 10 Aug 2018 09:13:52 +0000 (+0200) Subject: spi: davinci: fix a NULL pointer dereference X-Git-Tag: v4.9.126~61 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ae8f22ed6f92c3e1a7d0d4edb2d6dfbea51406b4;p=platform%2Fkernel%2Flinux-amlogic.git spi: davinci: fix a NULL pointer dereference commit 563a53f3906a6b43692498e5b3ae891fac93a4af upstream. On non-OF systems spi->controlled_data may be NULL. This causes a NULL pointer derefence on dm365-evm. Signed-off-by: Bartosz Golaszewski Signed-off-by: Mark Brown Cc: stable@vger.kernel.org Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/spi/spi-davinci.c b/drivers/spi/spi-davinci.c index 0d8f43a17edb..1905d20c229f 100644 --- a/drivers/spi/spi-davinci.c +++ b/drivers/spi/spi-davinci.c @@ -215,7 +215,7 @@ static void davinci_spi_chipselect(struct spi_device *spi, int value) pdata = &dspi->pdata; /* program delay transfers if tx_delay is non zero */ - if (spicfg->wdelay) + if (spicfg && spicfg->wdelay) spidat1 |= SPIDAT1_WDEL; /*