Skip to content

Commit

Permalink
mmc: cd-gpio: protect against NULL context in mmc_cd_gpio_free()
Browse files Browse the repository at this point in the history
Do not oops, even if mmc_cd_gpio_free() is mistakenly called on a driver
cleanup path, even though a previous call to mmc_cd_gpio_request() failed.

Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
[stable@: please apply to 3.3-stable]
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Chris Ball <cjb@laptop.org>
  • Loading branch information
Guennadi Liakhovetski authored and Chris Ball committed Apr 24, 2012
1 parent 0dd1bfe commit 0e9f480
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/mmc/core/cd-gpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ void mmc_cd_gpio_free(struct mmc_host *host)
{
struct mmc_cd_gpio *cd = host->hotplug.handler_priv;

if (!cd)
return;

free_irq(host->hotplug.irq, host);
gpio_free(cd->gpio);
kfree(cd);
Expand Down

0 comments on commit 0e9f480

Please sign in to comment.