Commit 4d0812c3 authored by Ohad Ben-Cohen's avatar Ohad Ben-Cohen Committed by Chris Ball

mmc: sdio: fix nasty oops in mmc_sdio_detect

Power off the card in mmc_sdio_detect __before__ a potential error
handler, which completely removes the card, executes, and only if the
card was successfully powered on beforehand.

While we're at it, use the _sync variant of the runtime PM put API, in
order to ensure that the card is left powered off in case an error
occurred, and the card is going to be removed.

Reproduced and tested on the OLPC XO-1.5.
Reported-by: default avatarDaniel Drake <dsd@laptop.org>
Signed-off-by: default avatarOhad Ben-Cohen <ohad@wizery.com>
Signed-off-by: default avatarChris Ball <cjb@laptop.org>
parent b432b4b3
...@@ -560,6 +560,19 @@ static void mmc_sdio_detect(struct mmc_host *host) ...@@ -560,6 +560,19 @@ static void mmc_sdio_detect(struct mmc_host *host)
mmc_release_host(host); mmc_release_host(host);
/*
* Tell PM core it's OK to power off the card now.
*
* The _sync variant is used in order to ensure that the card
* is left powered off in case an error occurred, and the card
* is going to be removed.
*
* Since there is no specific reason to believe a new user
* is about to show up at this point, the _sync variant is
* desirable anyway.
*/
pm_runtime_put_sync(&host->card->dev);
out: out:
if (err) { if (err) {
mmc_sdio_remove(host); mmc_sdio_remove(host);
...@@ -568,9 +581,6 @@ static void mmc_sdio_detect(struct mmc_host *host) ...@@ -568,9 +581,6 @@ static void mmc_sdio_detect(struct mmc_host *host)
mmc_detach_bus(host); mmc_detach_bus(host);
mmc_release_host(host); mmc_release_host(host);
} }
/* Tell PM core that we're done */
pm_runtime_put(&host->card->dev);
} }
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment