diff options
author | Pierre Ossman <drzeus@drzeus.cx> | 2007-07-22 17:08:30 -0400 |
---|---|---|
committer | Pierre Ossman <drzeus@drzeus.cx> | 2007-09-23 03:14:43 -0400 |
commit | adf66a0dc5e8be8d4e64f3c2114f9b175558235b (patch) | |
tree | afb62fc80a700a86a3e7613e1e6652e1e03f95bb /drivers/mmc/core/sd.c | |
parent | 17b0429dde9ab60f9cee8e07ab28c7dc6cfe6efd (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.c | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c index 00895c99d9b..0a04a6e86ca 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) | |||
213 | 213 | ||
214 | err = mmc_sd_switch(card, 0, 0, 1, status); | 214 | err = mmc_sd_switch(card, 0, 0, 1, status); |
215 | if (err) { | 215 | if (err) { |
216 | /* | ||
217 | * We all hosts that cannot perform the command | ||
218 | * to fail more gracefully | ||
219 | */ | ||
220 | if (err != -EINVAL) | ||
221 | goto out; | ||
222 | |||
216 | printk(KERN_WARNING "%s: problem reading switch " | 223 | printk(KERN_WARNING "%s: problem reading switch " |
217 | "capabilities, performance might suffer.\n", | 224 | "capabilities, performance might suffer.\n", |
218 | mmc_hostname(card->host)); | 225 | mmc_hostname(card->host)); |
219 | err = 0; | 226 | err = 0; |
227 | |||
220 | goto out; | 228 | goto out; |
221 | } | 229 | } |
222 | 230 | ||
@@ -324,8 +332,10 @@ static int mmc_sd_init_card(struct mmc_host *host, u32 ocr, | |||
324 | goto err; | 332 | goto err; |
325 | 333 | ||
326 | if (oldcard) { | 334 | if (oldcard) { |
327 | if (memcmp(cid, oldcard->raw_cid, sizeof(cid)) != 0) | 335 | if (memcmp(cid, oldcard->raw_cid, sizeof(cid)) != 0) { |
336 | err = -ENOENT; | ||
328 | goto err; | 337 | goto err; |
338 | } | ||
329 | 339 | ||
330 | card = oldcard; | 340 | card = oldcard; |
331 | } else { | 341 | } else { |
@@ -333,8 +343,10 @@ static int mmc_sd_init_card(struct mmc_host *host, u32 ocr, | |||
333 | * Allocate card structure. | 343 | * Allocate card structure. |
334 | */ | 344 | */ |
335 | card = mmc_alloc_card(host); | 345 | card = mmc_alloc_card(host); |
336 | if (IS_ERR(card)) | 346 | if (IS_ERR(card)) { |
347 | err = PTR_ERR(card); | ||
337 | goto err; | 348 | goto err; |
349 | } | ||
338 | 350 | ||
339 | card->type = MMC_TYPE_SD; | 351 | card->type = MMC_TYPE_SD; |
340 | memcpy(card->raw_cid, cid, sizeof(card->raw_cid)); | 352 | 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, | |||
358 | goto free_card; | 370 | goto free_card; |
359 | 371 | ||
360 | err = mmc_decode_csd(card); | 372 | err = mmc_decode_csd(card); |
361 | if (err < 0) | 373 | if (err) |
362 | goto free_card; | 374 | goto free_card; |
363 | 375 | ||
364 | mmc_decode_cid(card); | 376 | mmc_decode_cid(card); |
@@ -449,7 +461,7 @@ free_card: | |||
449 | mmc_remove_card(card); | 461 | mmc_remove_card(card); |
450 | err: | 462 | err: |
451 | 463 | ||
452 | return -EIO; | 464 | return err; |
453 | } | 465 | } |
454 | 466 | ||
455 | /* | 467 | /* |
@@ -666,6 +678,6 @@ err: | |||
666 | printk(KERN_ERR "%s: error %d whilst initialising SD card\n", | 678 | printk(KERN_ERR "%s: error %d whilst initialising SD card\n", |
667 | mmc_hostname(host), err); | 679 | mmc_hostname(host), err); |
668 | 680 | ||
669 | return 0; | 681 | return err; |
670 | } | 682 | } |
671 | 683 | ||