[U-Boot] [PATCH V2] cmd_mmc.c: check mmc_init() during mmc dev
Stephen Warren
swarren at wwwdotorg.org
Tue May 20 18:57:32 CEST 2014
From: Bryan Wu <cooloney at gmail.com>
mmc dev ${devnum} will return 0 as success even if there is no card
inserted. Booting script like tegra-common-post.h will call mmc dev
${devnum} to check the mmc device status, it always return 0 even if
mmc_init() fails.
Check mmc_init() return value let mmc dev command return failure
when mmc_init() fails.
Signed-off-by: Bryan Wu <pengw at nvidia.com>
[swarren: Always return 1 on error; hush doesn't appear to support
arbitrary return values. Fixed compilation error due to multiple
declaration of ret variable.]
Tested-by: Stephen Warren <swarren at nvidia.com>
Signed-off-by: Stephen Warren <swarren at nvidia.com>
---
v2:
* Always return 1 on error; hush doesn't appear to support
arbitrary return values.
* Fixed compilation error due to multiple declaration of ret variable.
---
common/cmd_mmc.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/common/cmd_mmc.c b/common/cmd_mmc.c
index 572aa895fa1c..2e564572f74d 100644
--- a/common/cmd_mmc.c
+++ b/common/cmd_mmc.c
@@ -217,7 +217,10 @@ static int do_mmcops(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
return 1;
}
- mmc_init(mmc);
+ ret = mmc_init(mmc);
+ if (ret)
+ return 1;
+
if (part != -1) {
ret = mmc_select_hwpart(dev, part);
printf("switch to partitions #%d, %s\n",
--
1.8.1.5
More information about the U-Boot
mailing list