Skip to contentSkip to conversation

spi: dw: fix crash on setup stage

PATCH Applied Andy Shevchenko 2 participants 2 messages Mar 25, 2015 1 message not in the archive SPI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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().

---
 drivers/spi/spi-dw.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/spi/spi-dw.c +1 -1
index cafac22..8d67d03 100644
@@ -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)
Signature · 6 lines
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Applied
#2 lore raw
In reply to a message not in the archive
Quoted 5 lines · Andy Shevchenko

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().

Applied, thanks.