[<prev] [next>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.02.1301171456380.4978@kaball.uk.xensource.com>
Date: Thu, 17 Jan 2013 15:15:25 +0000
From: Stefano Stabellini <stefano.stabellini@...citrix.com>
To: <linux-mmc@...r.kernel.org>
CC: <linux-kernel@...r.kernel.org>,
<linux-arm-kernel@...ts.infradead.org>, <cjb@...top.org>,
Stefano Stabellini <Stefano.Stabellini@...citrix.com>,
Ian Campbell <Ian.Campbell@...citrix.com>,
Pierre Ossman <drzeus@...eus.cx>
Subject: [PATCH] mmc_select_voltage only if host->ocr_avail_mmc
On my platform (ARM Versatile Express Cortex A15 emulator)
host->ocr_avail_mmc is 0.
mmc_attach_mmc knows that it could be 0, in fact at the beginning of the
function it checks if host->ocr_avail_mmc is not 0 before setting
host->ocr_avail.
However later on, is going to call mmc_select_voltage regardeless of its
value. If host->ocr_avail_mmc is 0, host->ocr ends up being 0 too, and
we error out.
I admit that I am not terribly familiar with this code, but it seems to
me that we should only call mmc_select_voltage and check the return
value if host->ocr_avail_mmc.
If that is not the right fix please advise.
---
mmc_attach_mmc: only call mmc_select_voltage if host->ocr_avail_mmc
host->ocr_avail_mmc can be 0, in fact mmc_attach_mmc checks if
host->ocr_avail_mmc is not 0 before setting host->ocr_avail.
However later on, is going to call mmc_select_voltage regardeless of its
value. If host->ocr_avail_mmc is 0, host->ocr ends up being 0 too, and
mmc_select_voltage errors out.
This patch fixes that by only calling mmc_select_voltage iff
host->ocr_avail_mmc != 0.
Signed-off-by: Stefano Stabellini <stefano.stabellini@...citrix.com>
diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
index e6e3911..0edd33b 100644
--- a/drivers/mmc/core/mmc.c
+++ b/drivers/mmc/core/mmc.c
@@ -1529,14 +1529,15 @@ int mmc_attach_mmc(struct mmc_host *host)
ocr &= ~0x7F;
}
- host->ocr = mmc_select_voltage(host, ocr);
-
- /*
- * Can we support the voltage of the card?
- */
- if (!host->ocr) {
- err = -EINVAL;
- goto err;
+ if (host->ocr_avail_mmc) {
+ host->ocr = mmc_select_voltage(host, ocr);
+ /*
+ * Can we support the voltage of the card?
+ */
+ if (!host->ocr) {
+ err = -EINVAL;
+ goto err;
+ }
}
/*
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists