From: Adrian Hunter <ext-adrian.hunter@nokia.com>
To: Tony Lindgren <tony@atomide.com>
Cc: "linux-omap@vger.kernel.org Mailing List" <linux-omap@vger.kernel.org>
Subject: [PATCH 5/9] OMAP: HSMMC: Fix oops in omap_mmc_remove
Date: Fri, 21 Nov 2008 11:24:53 +0200 [thread overview]
Message-ID: <49267E65.5030407@nokia.com> (raw)
Do not access host in omap_mmc_remove() if it is null. This
occurs when module is removed before its platform data is set.
Signed-off-by: Jarkko Lavinen <jarkko.lavinen@nokia.com>
---
drivers/mmc/host/omap_hsmmc.c | 20 +++++++++++---------
1 files changed, 11 insertions(+), 9 deletions(-)
diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 4bc25c0..f4b7c30 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -1128,15 +1128,17 @@ static int omap_mmc_remove(struct platform_device *pdev)
struct resource *res;
u16 vdd = 0;
- mmc_omap_fclk_state(host, ON);
- if (!(OMAP_HSMMC_READ(host->base, HCTL) & SDVSDET)) {
- /*
- * Set the vdd back to 3V,
- * applicable for dual volt support.
- */
- vdd = fls(host->mmc->ocr_avail) - 1;
- if (omap_mmc_switch_opcond(host, vdd) != 0)
- host->mmc->ios.vdd = vdd;
+ if (host) {
+ mmc_omap_fclk_state(host, ON);
+ if (!(OMAP_HSMMC_READ(host->base, HCTL) & SDVSDET)) {
+ /*
+ * Set the vdd back to 3V,
+ * applicable for dual volt support.
+ */
+ vdd = fls(host->mmc->ocr_avail) - 1;
+ if (omap_mmc_switch_opcond(host, vdd) != 0)
+ host->mmc->ios.vdd = vdd;
+ }
}
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
--
1.5.4.3
next reply other threads:[~2008-11-21 9:16 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-11-21 9:24 Adrian Hunter [this message]
-- strict thread matches above, loose matches on Subject: below --
2008-11-21 9:23 [PATCH 0/9] OMAP: HSMMC: Patches Adrian Hunter
2008-11-21 9:37 ` Adrian Hunter
2008-11-21 9:47 ` [PATCH 5/9] OMAP: HSMMC: Fix oops in omap_mmc_remove Adrian Hunter
2008-11-21 9:55 ` [PATCH 0/9] OMAP: HSMMC: Patches Adrian Hunter
2008-11-21 9:58 ` [PATCH 5/9] OMAP: HSMMC: Fix oops in omap_mmc_remove Adrian Hunter
2008-11-21 14:03 ` Grazvydas Ignotas
2008-11-21 15:27 ` Jarkko Lavinen
2008-11-21 21:08 ` Grazvydas Ignotas
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=49267E65.5030407@nokia.com \
--to=ext-adrian.hunter@nokia.com \
--cc=linux-omap@vger.kernel.org \
--cc=tony@atomide.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox