Commit 976d9276 authored by Pierre Ossman's avatar Pierre Ossman

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: default avatarPierre Ossman <drzeus@drzeus.cx>
parent 14d836e7
...@@ -99,6 +99,10 @@ EXPORT_SYMBOL(mmc_request_done); ...@@ -99,6 +99,10 @@ EXPORT_SYMBOL(mmc_request_done);
void void
mmc_start_request(struct mmc_host *host, struct mmc_request *mrq) 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", pr_debug("%s: starting CMD%u arg %08x flags %08x\n",
mmc_hostname(host), mrq->cmd->opcode, mmc_hostname(host), mrq->cmd->opcode,
mrq->cmd->arg, mrq->cmd->flags); mrq->cmd->arg, mrq->cmd->flags);
...@@ -113,6 +117,13 @@ mmc_start_request(struct mmc_host *host, struct mmc_request *mrq) ...@@ -113,6 +117,13 @@ mmc_start_request(struct mmc_host *host, struct mmc_request *mrq)
BUG_ON(mrq->data->blocks * mrq->data->blksz > BUG_ON(mrq->data->blocks * mrq->data->blksz >
host->max_req_size); 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->cmd->data = mrq->data;
mrq->data->error = 0; mrq->data->error = 0;
mrq->data->mrq = mrq; mrq->data->mrq = mrq;
......
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