From: "Pali Rohár" <pali@kernel.org>
To: Simon Glass <sjg@chromium.org>, Heinrich Schuchardt <xypron.glpk@gmx.de>
Cc: u-boot@lists.denx.de, Martin Rowe <martin.p.rowe@gmail.com>
Subject: [PATCH v2 u-boot] cmd: mmc: Return CMD_RET_* from commands
Date: Wed, 22 Mar 2023 21:06:53 +0100 [thread overview]
Message-ID: <20230322200653.8360-1-pali@kernel.org> (raw)
In-Reply-To: <20230319163342.15385-1-pali@kernel.org>
Numeric return values may cause strange errors line:
exit not allowed from main input shell.
Signed-off-by: Pali Rohár <pali@kernel.org>
---
Rename r to ret.
---
cmd/mmc.c | 18 +++++++++++++-----
1 file changed, 13 insertions(+), 5 deletions(-)
diff --git a/cmd/mmc.c b/cmd/mmc.c
index c79d9407986d..539d3e0bf768 100644
--- a/cmd/mmc.c
+++ b/cmd/mmc.c
@@ -175,7 +175,7 @@ static int do_mmcinfo(struct cmd_tbl *cmdtp, int flag, int argc,
curr_device = 0;
else {
puts("No MMC device available\n");
- return 1;
+ return CMD_RET_FAILURE;
}
}
@@ -927,7 +927,7 @@ static int mmc_partconf_print(struct mmc *mmc, const char *varname)
static int do_mmc_partconf(struct cmd_tbl *cmdtp, int flag,
int argc, char *const argv[])
{
- int dev;
+ int ret, dev;
struct mmc *mmc;
u8 ack, part_num, access;
@@ -953,13 +953,17 @@ static int do_mmc_partconf(struct cmd_tbl *cmdtp, int flag,
access = dectoul(argv[4], NULL);
/* acknowledge to be sent during boot operation */
- return mmc_set_part_conf(mmc, ack, part_num, access);
+ ret = mmc_set_part_conf(mmc, ack, part_num, access);
+ if (ret != 0)
+ return CMD_RET_FAILURE;
+
+ return CMD_RET_SUCCESS;
}
static int do_mmc_rst_func(struct cmd_tbl *cmdtp, int flag,
int argc, char *const argv[])
{
- int dev;
+ int ret, dev;
struct mmc *mmc;
u8 enable;
@@ -988,7 +992,11 @@ static int do_mmc_rst_func(struct cmd_tbl *cmdtp, int flag,
return CMD_RET_FAILURE;
}
- return mmc_set_rst_n_function(mmc, enable);
+ ret = mmc_set_rst_n_function(mmc, enable);
+ if (ret != 0)
+ return CMD_RET_FAILURE;
+
+ return CMD_RET_SUCCESS;
}
#endif
static int do_mmc_setdsr(struct cmd_tbl *cmdtp, int flag,
--
2.20.1
next prev parent reply other threads:[~2023-03-22 20:07 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-19 16:33 [PATCH u-boot] cmd: mmc: Return CMD_RET_* from commands Pali Rohár
2023-03-19 19:29 ` Simon Glass
2023-03-19 19:39 ` Pali Rohár
2023-03-22 20:06 ` Pali Rohár [this message]
2023-03-23 18:28 ` [PATCH v2 " Simon Glass
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=20230322200653.8360-1-pali@kernel.org \
--to=pali@kernel.org \
--cc=martin.p.rowe@gmail.com \
--cc=sjg@chromium.org \
--cc=u-boot@lists.denx.de \
--cc=xypron.glpk@gmx.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox