cmd_mmc: Use init_mmc_device() from do_mmc_rescan()

The body of init_mmc_device() is now identical to that of do_mmc_rescan()
except for the error codes returned. Modify do_mmc_rescan() to simply
call init_mmc_device() and convert the error codes, to avoid code
duplication.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Pantelis Antoniou <panto@antoniou-consulting.com>
This commit is contained in:
Stephen Warren 2014-05-23 13:24:46 -06:00 committed by Pantelis Antoniou
parent 1ae24a5041
commit 941944e445

View File

@ -371,16 +371,10 @@ static int do_mmc_rescan(cmd_tbl_t *cmdtp, int flag,
{
struct mmc *mmc;
mmc = find_mmc_device(curr_device);
if (!mmc) {
printf("no mmc device at slot %x\n", curr_device);
mmc = init_mmc_device(curr_device, true);
if (!mmc)
return CMD_RET_FAILURE;
}
mmc->has_init = 0;
if (mmc_init(mmc))
return CMD_RET_FAILURE;
return CMD_RET_SUCCESS;
}
static int do_mmc_part(cmd_tbl_t *cmdtp, int flag,