Commit 613b152c authored by Russell King's avatar Russell King

ARM: mmci: round down the bytes transferred on error

We should not report incomplete blocks on error.  Return the number of
bytes successfully transferred, rounded down to the nearest block.
Acked-by: default avatarLinus Walleij <linus.walleij@stericsson.com>
Signed-off-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
parent ccff9b51
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#include <linux/ioport.h> #include <linux/ioport.h>
#include <linux/device.h> #include <linux/device.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/kernel.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/err.h> #include <linux/err.h>
#include <linux/highmem.h> #include <linux/highmem.h>
...@@ -289,13 +290,13 @@ mmci_data_irq(struct mmci_host *host, struct mmc_data *data, ...@@ -289,13 +290,13 @@ mmci_data_irq(struct mmci_host *host, struct mmc_data *data,
dev_dbg(mmc_dev(host->mmc), "MCI ERROR IRQ (status %08x)\n", status); dev_dbg(mmc_dev(host->mmc), "MCI ERROR IRQ (status %08x)\n", status);
if (status & MCI_DATACRCFAIL) { if (status & MCI_DATACRCFAIL) {
/* Last block was not successful */ /* Last block was not successful */
host->data_xfered = ((success - 1) / data->blksz) * data->blksz; host->data_xfered = round_down(success - 1, data->blksz);
data->error = -EILSEQ; data->error = -EILSEQ;
} else if (status & MCI_DATATIMEOUT) { } else if (status & MCI_DATATIMEOUT) {
host->data_xfered = success; host->data_xfered = round_down(success, data->blksz);
data->error = -ETIMEDOUT; data->error = -ETIMEDOUT;
} else if (status & (MCI_TXUNDERRUN|MCI_RXOVERRUN)) { } else if (status & (MCI_TXUNDERRUN|MCI_RXOVERRUN)) {
host->data_xfered = success; host->data_xfered = round_down(success, data->blksz);
data->error = -EIO; data->error = -EIO;
} }
......
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