aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mmc
diff options
context:
space:
mode:
authorGuennadi Liakhovetski <g.liakhovetski@gmx.de>2012-04-24 11:56:29 -0400
committerChris Ball <cjb@laptop.org>2012-04-24 12:21:22 -0400
commit0e9f480bb553d39ee06ccd45639ba7a5446a7b81 (patch)
treeb6de3a76c45c5fdfc9a6d1229c77906d067b853a /drivers/mmc
parent0dd1bfeb6cc89467261cc62ca81e0ac5da78ec0a (diff)
mmc: cd-gpio: protect against NULL context in mmc_cd_gpio_free()
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>
Diffstat (limited to 'drivers/mmc')
-rw-r--r--drivers/mmc/core/cd-gpio.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/mmc/core/cd-gpio.c b/drivers/mmc/core/cd-gpio.c
index 2c14be73254c..f13e38deceac 100644
--- a/drivers/mmc/core/cd-gpio.c
+++ b/drivers/mmc/core/cd-gpio.c
@@ -73,6 +73,9 @@ void mmc_cd_gpio_free(struct mmc_host *host)
73{ 73{
74 struct mmc_cd_gpio *cd = host->hotplug.handler_priv; 74 struct mmc_cd_gpio *cd = host->hotplug.handler_priv;
75 75
76 if (!cd)
77 return;
78
76 free_irq(host->hotplug.irq, host); 79 free_irq(host->hotplug.irq, host);
77 gpio_free(cd->gpio); 80 gpio_free(cd->gpio);
78 kfree(cd); 81 kfree(cd);