Skip to contentSkip to conversation

pxa2xx_spi: prevent panic case setup() fails

PATCH David Brownell 1 participant 1 message May 8, 2009 SPI

lore
Share & tools
lore
#0 lore raw

for 2.6.30 please

---------- Forwarded Message ----------

Subject: pxa2xx_spi: prevent panic case setup() fails
Date: Friday 08 May 2009
From: Daniel Ribeiro <[email protected]>
To: Eric Miao <[email protected]>

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 · 11 lines
Daniel Ribeiro


-------------------------------------------------------

------------------------------------------------------------------------------
The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
production scanning environment may not be a perfect world - but thanks to
Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
Series Scanner you'll get full speed at 300 dpi even with all image 
processing features enabled. http://p.sf.net/sfu/kodak-com