Skip to content

Commit

Permalink
pxa2xx_spi: prevent panic case setup() fails
Browse files Browse the repository at this point in the history
setup() may fail before ctldata is set, causing a kernel panic on
cleanup().

Signed-off-by: Daniel Ribeiro <drwyrm@gmail.com>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Cc: Eric Miao <eric.y.miao@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Daniel Ribeiro authored and Linus Torvalds committed May 12, 2009
1 parent 816dc3c commit 7348d82
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/spi/pxa2xx_spi.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 7348d82

Please sign in to comment.