From 90102c17f9caaaf8ad8ec241df0a434aa3d8c643 Mon Sep 17 00:00:00 2001 From: Pratibhasagar V Date: Wed, 9 Apr 2014 12:52:46 +0530 Subject: [PATCH] mmc: core: Exit clock scaling prior to removing the card After removing the SD/MMC 'card' from the driver model we are cancelling the pending clock scaling work which accesses card->dev. This could cause NULL pointer issue as the card is already removed. CRs-Fixed: 640344 Change-Id: I8c5ee817e3f116dedf0bf4fb51eb6b70d52467b7 Signed-off-by: Pratibhasagar V --- drivers/mmc/core/mmc.c | 3 ++- drivers/mmc/core/sd.c | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index 50d1eb11eaeb..351fc78d0d7c 100644 --- a/drivers/mmc/core/mmc.c +++ b/drivers/mmc/core/mmc.c @@ -1908,11 +1908,12 @@ static void mmc_remove(struct mmc_host *host) BUG_ON(!host->card); unregister_reboot_notifier(&host->card->reboot_notify); + + mmc_exit_clk_scaling(host); mmc_remove_card(host->card); mmc_claim_host(host); host->card = NULL; - mmc_exit_clk_scaling(host); mmc_release_host(host); } diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c index 165b6f2b729e..092b447ae901 100644 --- a/drivers/mmc/core/sd.c +++ b/drivers/mmc/core/sd.c @@ -1119,11 +1119,11 @@ static void mmc_sd_remove(struct mmc_host *host) BUG_ON(!host); BUG_ON(!host->card); + mmc_exit_clk_scaling(host); mmc_remove_card(host->card); mmc_claim_host(host); host->card = NULL; - mmc_exit_clk_scaling(host); mmc_release_host(host); }