spi: dw: fix crash on setup stage

The commit 1a7b7ee72c (spi: Ensure that CS line is in non-active state after
spi_setup()) introduces an unconditional call of spi_set_cs() before ->setup().
The dw_spi_set_cs() relies on that fact that ->setup() is already called, but
it doesn't now. This patch fixes the crash by adding an additional check to
dw_spi_set_cs().

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Andy Shevchenko 2015-03-25 20:26:26 +02:00 committed by Mark Brown
parent 36111da783
commit 207cda93f0
1 changed files with 1 additions and 1 deletions

View File

@ -144,7 +144,7 @@ static void dw_spi_set_cs(struct spi_device *spi, bool enable)
struct chip_data *chip = spi_get_ctldata(spi);
/* Chip select logic is inverted from spi_set_cs() */
if (chip->cs_control)
if (chip && chip->cs_control)
chip->cs_control(!enable);
if (!enable)