cmd: mmc: find current device first before find mmc device

Find the current device before find mmc device, otherwise '-1'
will be use as curr_device and error occur. The error log is
"MMC Device -1 not found".

Change-Id: Id6157f73d006f4bbe1c4d105244eb59ca7290c13
Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
This commit is contained in:
Jason Zhu 2019-06-25 21:59:03 +08:00 committed by Jianhong Chen
parent 278b570da4
commit b75a3992f5
1 changed files with 9 additions and 0 deletions

View File

@ -188,6 +188,15 @@ int init_rpmb(void)
{ {
struct mmc *mmc; struct mmc *mmc;
if (curr_device < 0) {
if (get_mmc_num() > 0) {
curr_device = 0;
} else {
printf("No MMC device available\n");
return CMD_RET_FAILURE;
}
}
mmc = init_mmc_device(curr_device, false); mmc = init_mmc_device(curr_device, false);
if (!mmc) if (!mmc)
return CMD_RET_FAILURE; return CMD_RET_FAILURE;