[MMC] Fail I/O to stopped SD card; avoid dividing by zero
David Woodhouse
dwmw2 at infradead.org
Tue Nov 7 22:38:28 EST 2006
Commit: 74e21efd27175886b41afdbe26404b0393feb3d6
Parent: f654a92bbe93efff10e355716cf0120cffaa4380
commit 74e21efd27175886b41afdbe26404b0393feb3d6
Author: David Woodhouse <dwmw2 at infradead.org>
AuthorDate: Tue Oct 31 22:04:24 2006 +0800
Commit: David Woodhouse <dwmw2 at infradead.org>
CommitDate: Tue Oct 31 22:04:24 2006 +0800
[MMC] Fail I/O to stopped SD card; avoid dividing by zero
When we reset an SD host, we set the clock to zero. Dividing the
required timeout for I/O by zero is not a good thing, and we might
as well just abort the I/O early since it's not going to work anyway.
Signed-off-by: David Woodhouse <dwmw2 at infradead.org>
---
drivers/mmc/mmc_block.c | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/drivers/mmc/mmc_block.c b/drivers/mmc/mmc_block.c
index f9027c8..0ea0e92 100644
--- a/drivers/mmc/mmc_block.c
+++ b/drivers/mmc/mmc_block.c
@@ -246,6 +246,11 @@ static int mmc_blk_issue_rq(struct mmc_q
brq.stop.arg = 0;
brq.stop.flags = MMC_RSP_R1B | MMC_CMD_AC;
+ if (mmc_card_sd(card) && !card->host->ios.clock) {
+ printk(KERN_ERR "%s: I/O to stopped card\n",
+ req->rq_disk->disk_name);
+ goto cmd_err;
+ }
mmc_set_data_timeout(&brq.data, card, rq_data_dir(req) != READ);
/*
More information about the Commits-kernel
mailing list