summaryrefslogtreecommitdiff
path: root/drivers/mmc/core/sd.c
diff options
context:
space:
mode:
authorPierre Ossman <drzeus@drzeus.cx>2007-07-22 23:08:30 +0200
committerPierre Ossman <drzeus@drzeus.cx>2007-09-23 09:14:43 +0200
commitadf66a0dc5e8be8d4e64f3c2114f9b175558235b (patch)
treeafb62fc80a700a86a3e7613e1e6652e1e03f95bb /drivers/mmc/core/sd.c
parent17b0429dde9ab60f9cee8e07ab28c7dc6cfe6efd (diff)
mmc: improve error code feedback
Now that we use "normal" error codes, improve the reporting and response to error codes in the core. Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
Diffstat (limited to 'drivers/mmc/core/sd.c')
-rw-r--r--drivers/mmc/core/sd.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c
index 00895c99d9bb..0a04a6e86ca1 100644
--- a/drivers/mmc/core/sd.c
+++ b/drivers/mmc/core/sd.c
@@ -213,10 +213,18 @@ static int mmc_read_switch(struct mmc_card *card)
err = mmc_sd_switch(card, 0, 0, 1, status);
if (err) {
+ /*
+ * We all hosts that cannot perform the command
+ * to fail more gracefully
+ */
+ if (err != -EINVAL)
+ goto out;
+
printk(KERN_WARNING "%s: problem reading switch "
"capabilities, performance might suffer.\n",
mmc_hostname(card->host));
err = 0;
+
goto out;
}
@@ -324,8 +332,10 @@ static int mmc_sd_init_card(struct mmc_host *host, u32 ocr,
goto err;
if (oldcard) {
- if (memcmp(cid, oldcard->raw_cid, sizeof(cid)) != 0)
+ if (memcmp(cid, oldcard->raw_cid, sizeof(cid)) != 0) {
+ err = -ENOENT;
goto err;
+ }
card = oldcard;
} else {
@@ -333,8 +343,10 @@ static int mmc_sd_init_card(struct mmc_host *host, u32 ocr,
* Allocate card structure.
*/
card = mmc_alloc_card(host);
- if (IS_ERR(card))
+ if (IS_ERR(card)) {
+ err = PTR_ERR(card);
goto err;
+ }
card->type = MMC_TYPE_SD;
memcpy(card->raw_cid, cid, sizeof(card->raw_cid));
@@ -358,7 +370,7 @@ static int mmc_sd_init_card(struct mmc_host *host, u32 ocr,
goto free_card;
err = mmc_decode_csd(card);
- if (err < 0)
+ if (err)
goto free_card;
mmc_decode_cid(card);
@@ -449,7 +461,7 @@ free_card:
mmc_remove_card(card);
err:
- return -EIO;
+ return err;
}
/*
@@ -666,6 +678,6 @@ err:
printk(KERN_ERR "%s: error %d whilst initialising SD card\n",
mmc_hostname(host), err);
- return 0;
+ return err;
}