aboutsummaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorWolfgang Muees <wolfgang.mues@auerswald.de>2009-05-26 08:56:19 +0100
committerPierre Ossman <pierre@ossman.eu>2009-06-13 22:42:59 +0200
commitfdd858db7113ca64132de390188d7ca00701013d (patch)
treecf24d0a46c06fa489730553d97279a93b0a1b9e1 /drivers
parentc54f6bc67a4398243682f7438a2129906e127d21 (diff)
mmc_spi: don't use EINVAL for possible transmission errors
This patch changes the reported error code for the responses to a command from EINVAL to EFAULT/ENOSYS, as EINVAL is reserved for non-recoverable host errors, and the responses from the SD/MMC card may be because of recoverable transmission errors in the command or in the response. Response codes in SPI mode are NOT protected by a checksum, so don't trust them. Signed-off-by: Wolfgang Muees <wolfgang.mues@auerswald.de> Acked-by: Matt Fleming <matt@console-pimps.org> Signed-off-by: Pierre Ossman <pierre@ossman.eu>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/mmc/host/mmc_spi.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/drivers/mmc/host/mmc_spi.c b/drivers/mmc/host/mmc_spi.c
index a789db8eed2..240608cc7ae 100644
--- a/drivers/mmc/host/mmc_spi.c
+++ b/drivers/mmc/host/mmc_spi.c
@@ -335,15 +335,16 @@ checkstatus:
/* Status byte: the entire seven-bit R1 response. */
if (cmd->resp[0] != 0) {
- if ((R1_SPI_PARAMETER | R1_SPI_ADDRESS
- | R1_SPI_ILLEGAL_COMMAND)
+ if ((R1_SPI_PARAMETER | R1_SPI_ADDRESS)
& cmd->resp[0])
- value = -EINVAL;
+ value = -EFAULT; /* Bad address */
+ else if (R1_SPI_ILLEGAL_COMMAND & cmd->resp[0])
+ value = -ENOSYS; /* Function not implemented */
else if (R1_SPI_COM_CRC & cmd->resp[0])
- value = -EILSEQ;
+ value = -EILSEQ; /* Illegal byte sequence */
else if ((R1_SPI_ERASE_SEQ | R1_SPI_ERASE_RESET)
& cmd->resp[0])
- value = -EIO;
+ value = -EIO; /* I/O error */
/* else R1_SPI_IDLE, "it's resetting" */
}