Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

spi: dw: fix crash on setup stage

The commit 1a7b7ee72c21 (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>

authored by

Andy Shevchenko and committed by
Mark Brown
207cda93 36111da7

+1 -1
+1 -1
drivers/spi/spi-dw.c
··· 144 144 struct chip_data *chip = spi_get_ctldata(spi); 145 145 146 146 /* Chip select logic is inverted from spi_set_cs() */ 147 - if (chip->cs_control) 147 + if (chip && chip->cs_control) 148 148 chip->cs_control(!enable); 149 149 150 150 if (!enable)