提交 7348d82a 编写于 作者: D Daniel Ribeiro 提交者: Linus Torvalds

pxa2xx_spi: prevent panic case setup() fails

setup() may fail before ctldata is set, causing a kernel panic on
cleanup().
Signed-off-by: NDaniel Ribeiro <drwyrm@gmail.com>
Signed-off-by: NDavid Brownell <dbrownell@users.sourceforge.net>
Cc: Eric Miao <eric.y.miao@gmail.com>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 816dc3c8
......@@ -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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册