diff mbox

[U-Boot,2/2] drivers/mmc/fsl_esdhc.c: reordered tests

Message ID 1280587518-2097-2-git-send-email-fransmeulenbroeks@gmail.com
State Accepted
Commit 63fb5a7e4b0ada0bf77dd89120a61d2bd14e50af
Delegated to: Andy Fleming
Headers show

Commit Message

Frans Meulenbroeks July 31, 2010, 2:45 p.m. UTC
As DATA_ERROR includes the value IRQSTAT_DTOE, a timeout error
would yield the first error return instead of TIMEOUT.
By swapping the test TIMEOUTs are reported as such

An alternate solution would be to remove the IRQSTAT_DTOE from the DATA_ERROR define
but as that one might be less desired I've opted for the simplest solution

Signed-off-by: Frans Meulenbroeks <fransmeulenbroeks@gmail.com>
 drivers/mmc/fsl_esdhc.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
diff mbox


diff --git a/drivers/mmc/fsl_esdhc.c b/drivers/mmc/fsl_esdhc.c
index f982a69..4d04920 100644
--- a/drivers/mmc/fsl_esdhc.c
+++ b/drivers/mmc/fsl_esdhc.c
@@ -305,11 +305,11 @@  esdhc_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd, struct mmc_data *data)
 		do {
 			irqstat = esdhc_read32(&regs->irqstat);
-			if (irqstat & DATA_ERR)
-				return COMM_ERR;
 			if (irqstat & IRQSTAT_DTOE)
 				return TIMEOUT;
+			if (irqstat & DATA_ERR)
+				return COMM_ERR;
 		} while (!(irqstat & IRQSTAT_TC) &&
 				(esdhc_read32(&regs->prsstat) & PRSSTAT_DLA));