summaryrefslogtreecommitdiffstats
path: root/drivers/mmc
diff options
context:
space:
mode:
authorPierre Ossman <drzeus@drzeus.cx>2007-04-13 22:47:01 +0200
committerPierre Ossman <drzeus@drzeus.cx>2007-05-01 13:04:12 +0200
commit976d9276c826d6b35e4a2478fd4978dbd63bdd6f (patch)
tree0d90e7f4c96a850503776218fec74db1ead46963 /drivers/mmc
parent14d836e7499c53a1f6a65086c3d11600e871a971 (diff)
downloadop-kernel-dev-976d9276c826d6b35e4a2478fd4978dbd63bdd6f.zip
op-kernel-dev-976d9276c826d6b35e4a2478fd4978dbd63bdd6f.tar.gz
mmc: enforce correct sg list
Now that we've fixed our only offender when it comes to strange sg list, add a check so that future users keep the sg list proper with regard to transfer size. Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
Diffstat (limited to 'drivers/mmc')
-rw-r--r--drivers/mmc/mmc.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
index 4a73e8b..e8f896c 100644
--- a/drivers/mmc/mmc.c
+++ b/drivers/mmc/mmc.c
@@ -99,6 +99,10 @@ EXPORT_SYMBOL(mmc_request_done);
void
mmc_start_request(struct mmc_host *host, struct mmc_request *mrq)
{
+#ifdef CONFIG_MMC_DEBUG
+ unsigned int i, sz;
+#endif
+
pr_debug("%s: starting CMD%u arg %08x flags %08x\n",
mmc_hostname(host), mrq->cmd->opcode,
mrq->cmd->arg, mrq->cmd->flags);
@@ -113,6 +117,13 @@ mmc_start_request(struct mmc_host *host, struct mmc_request *mrq)
BUG_ON(mrq->data->blocks * mrq->data->blksz >
host->max_req_size);
+#ifdef CONFIG_MMC_DEBUG
+ sz = 0;
+ for (i = 0;i < mrq->data->sg_len;i++)
+ sz += mrq->data->sg[i].length;
+ BUG_ON(sz != mrq->data->blocks * mrq->data->blksz);
+#endif
+
mrq->cmd->data = mrq->data;
mrq->data->error = 0;
mrq->data->mrq = mrq;
OpenPOWER on IntegriCloud