From: Stephen Warren <swarren@wwwdotorg.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] cmd_mmc.c: check mmc_init() during mmc dev
Date: Tue, 20 May 2014 10:55:59 -0600 [thread overview]
Message-ID: <537B891F.9060907@wwwdotorg.org> (raw)
In-Reply-To: <1400545060-31023-1-git-send-email-pengw@nvidia.com>
On 05/19/2014 06:17 PM, Bryan Wu wrote:
> 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.
You probably want to Cc the MMC maintainer.
> diff --git a/common/cmd_mmc.c b/common/cmd_mmc.c
> @@ -195,6 +195,7 @@ static int do_mmcops(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
> } else if (strcmp(argv[1], "dev") == 0) {
> int dev, part = -1;
> struct mmc *mmc;
> + int ret;
The latest u-boot.git master branch already declares ret a couple lines
above. Hence, this patch doesn't compile.
> - mmc_init(mmc);
> + ret = mmc_init(mmc);
> + if (ret)
> + return ret;
I know that I said off-list to return ret here, but it actually looks
like U-Boot commands must not return arbitrary values, but rather must
return 0, 1, or CMD_RET_USAGE. The current code prints the following on
failure:
Tegra124 (Jetson TK1) # mmc dev 1
MMC: no card present
exit not allowed from main input shell.
I'll send a V2 patch with these fixed.
next prev parent reply other threads:[~2014-05-20 16:55 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-20 0:17 [U-Boot] [PATCH] cmd_mmc.c: check mmc_init() during mmc dev Bryan Wu
2014-05-20 16:55 ` Stephen Warren [this message]
2014-05-20 18:13 ` Bryan Wu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=537B891F.9060907@wwwdotorg.org \
--to=swarren@wwwdotorg.org \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.