diff options
author | Adrian Hunter <adrian.hunter@intel.com> | 2011-09-23 05:48:20 -0400 |
---|---|---|
committer | Chris Ball <cjb@laptop.org> | 2011-10-26 16:32:14 -0400 |
commit | 0d7d85ca6e5dc7bd426d1d5989a44e93e8c7a0d3 (patch) | |
tree | 08d4f1be8e4bdab4053721c982b47ccb20926d5d /drivers/mmc/card | |
parent | b87d8dbf6c410b5f2d9b6893c85baa06aa131c7c (diff) |
mmc: block: fix boot partition switch error path
In the case of a switch error, do not update partition config as though
the switch succeeded, and ensure blk_end_request is called on the
failed request.
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Acked-by: Andrei Warkentin <andrey.warkentin@gmail.com>
Signed-off-by: Chris Ball <cjb@laptop.org>
Diffstat (limited to 'drivers/mmc/card')
-rw-r--r-- | drivers/mmc/card/block.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c index 66c7596c5546..d7eb2c082336 100644 --- a/drivers/mmc/card/block.c +++ b/drivers/mmc/card/block.c | |||
@@ -447,18 +447,23 @@ static inline int mmc_blk_part_switch(struct mmc_card *card, | |||
447 | { | 447 | { |
448 | int ret; | 448 | int ret; |
449 | struct mmc_blk_data *main_md = mmc_get_drvdata(card); | 449 | struct mmc_blk_data *main_md = mmc_get_drvdata(card); |
450 | |||
450 | if (main_md->part_curr == md->part_type) | 451 | if (main_md->part_curr == md->part_type) |
451 | return 0; | 452 | return 0; |
452 | 453 | ||
453 | if (mmc_card_mmc(card)) { | 454 | if (mmc_card_mmc(card)) { |
454 | card->ext_csd.part_config &= ~EXT_CSD_PART_CONFIG_ACC_MASK; | 455 | u8 part_config = card->ext_csd.part_config; |
455 | card->ext_csd.part_config |= md->part_type; | 456 | |
457 | part_config &= ~EXT_CSD_PART_CONFIG_ACC_MASK; | ||
458 | part_config |= md->part_type; | ||
456 | 459 | ||
457 | ret = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, | 460 | ret = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, |
458 | EXT_CSD_PART_CONFIG, card->ext_csd.part_config, | 461 | EXT_CSD_PART_CONFIG, part_config, |
459 | card->ext_csd.part_time); | 462 | card->ext_csd.part_time); |
460 | if (ret) | 463 | if (ret) |
461 | return ret; | 464 | return ret; |
465 | |||
466 | card->ext_csd.part_config = part_config; | ||
462 | } | 467 | } |
463 | 468 | ||
464 | main_md->part_curr = md->part_type; | 469 | main_md->part_curr = md->part_type; |
@@ -1273,6 +1278,11 @@ static int mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req) | |||
1273 | 1278 | ||
1274 | ret = mmc_blk_part_switch(card, md); | 1279 | ret = mmc_blk_part_switch(card, md); |
1275 | if (ret) { | 1280 | if (ret) { |
1281 | if (req) { | ||
1282 | spin_lock_irq(&md->lock); | ||
1283 | __blk_end_request_all(req, -EIO); | ||
1284 | spin_unlock_irq(&md->lock); | ||
1285 | } | ||
1276 | ret = 0; | 1286 | ret = 0; |
1277 | goto out; | 1287 | goto out; |
1278 | } | 1288 | } |