From: Pierre Ossman Date: Fri, 10 Apr 2009 15:52:57 +0000 (+0200) Subject: mmc_block: be prepared for oversized requests X-Git-Tag: v2.6.30-rc5~43^2~5 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=548d2de9bd978a4d4e941477500f1ab97aade137;p=profile%2Fcommon%2Fkernel-common.git 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 --- diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c index fe8041e..b25e9b6 100644 --- a/drivers/mmc/card/block.c +++ b/drivers/mmc/card/block.c @@ -254,6 +254,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.