Skip to contentSkip to conversation

pxa2xx_spi: prevent panic case setup() fails

PATCH Daniel Ribeiro 1 participant 1 message May 8, 2009 SPI

lore
Share & tools
lore
#0 lore raw

setup() may fail before ctldata is set, causing a kernel panic on cleanup().

drivers/spi/pxa2xx_spi.c +3 -0
index 885194a..2801307 100644
@@ -1373,6 +1373,9 @@ static void cleanup(struct spi_device *spi)
 {
 	struct chip_data *chip = spi_get_ctldata(spi);
 
+	if (!chip)
+		return;
+
 	if (gpio_is_valid(chip->gpio_cs))
 		gpio_free(chip->gpio_cs);
 
Signature · 1 line
Daniel Ribeiro