summaryrefslogtreecommitdiff
path: root/drivers/mmc
diff options
context:
space:
mode:
authorPierre Ossman <pierre@ossman.eu>2009-04-10 17:52:57 +0200
committerSan Mehat <san@google.com>2009-08-17 07:50:12 -0700
commit333495c0cc589ba108deb386cc7eaffcae9070f4 (patch)
treea1d2aec7e84c1a54ce119c663908cc49ecfc5aa3 /drivers/mmc
parent6010804968cb4aa951e0ddca3e198c40fc13db15 (diff)
mmc_block: be prepared for oversized requests
The block layer does not support very low sector count restrictions so we need to be prepared to handle bigger requests than we can send directly to the controller. Problem found by Manuel Lauss. Signed-off-by: Pierre Ossman <pierre@ossman.eu> Signed-off-by: San Mehat <san@google.com>
Diffstat (limited to 'drivers/mmc')
-rw-r--r--drivers/mmc/card/block.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c
index 71c3e4a2f84a..6f48a942be78 100644
--- a/drivers/mmc/card/block.c
+++ b/drivers/mmc/card/block.c
@@ -288,6 +288,14 @@ static int mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req)
brq.data.blocks = req->nr_sectors;
/*
+ * The block layer doesn't support all sector count
+ * restrictions, so we need to be prepared for too big
+ * requests.
+ */
+ if (brq.data.blocks > card->host->max_blk_count)
+ brq.data.blocks = card->host->max_blk_count;
+
+ /*
* After a read error, we redo the request one sector at a time
* in order to accurately determine which sectors can be read
* successfully.