spi: davinci: fix a NULL pointer dereference
authorBartosz Golaszewski <bgolaszewski@baylibre.com>
Fri, 10 Aug 2018 09:13:52 +0000 (11:13 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 9 Sep 2018 17:55:52 +0000 (19:55 +0200)
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 <bgolaszewski@baylibre.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Cc: stable@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/spi/spi-davinci.c

index 6ddb6ef1fda4ff0900b97d7b87942bbe9935475d..c5bbe08771a4d06894e14b284a589f2149d58f02 100644 (file)
@@ -217,7 +217,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;
 
        /*