From: Gary Bisson <gary.bisson@boundarydevices.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] cmd: sata: fix init command return value
Date: Wed, 11 Jan 2017 16:51:53 +0100 [thread overview]
Message-ID: <20170111155153.21311-1-gary.bisson@boundarydevices.com> (raw)
Since commit aa6ab905b2, sata_initialize returns -1 if init_sata or
scan_sata fails. But this return value becomes the do_sata return
value which is equivalent to CMD_RET_USAGE.
In case one issues 'sata init' and that the hardware fails to
initialize, there's no need to display the command usage. Instead
the command shoud just return the CMD_RET_FAILURE value.
Fixes: aa6ab905b2 (sata: fix sata command can not being executed bug)
Signed-off-by: Gary Bisson <gary.bisson@boundarydevices.com>
---
cmd/sata.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/cmd/sata.c b/cmd/sata.c
index f56622acc2..4c53022ff6 100644
--- a/cmd/sata.c
+++ b/cmd/sata.c
@@ -28,14 +28,15 @@ static int do_sata(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
if (sata_curr_device != -1)
sata_stop();
- return sata_initialize();
+ return (sata_initialize() < 0) ?
+ CMD_RET_FAILURE : CMD_RET_SUCCESS;
}
/* If the user has not yet run `sata init`, do it now */
if (sata_curr_device == -1) {
rc = sata_initialize();
if (rc == -1)
- return rc;
+ return CMD_RET_FAILURE;
sata_curr_device = rc;
}
--
2.11.0
next reply other threads:[~2017-01-11 15:51 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-11 15:51 Gary Bisson [this message]
2017-01-11 16:28 ` [U-Boot] [PATCH] cmd: sata: fix init command return value Eric Nelson
2017-01-12 5:07 ` Simon Glass
2017-01-15 18:32 ` [U-Boot] " Tom Rini
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=20170111155153.21311-1-gary.bisson@boundarydevices.com \
--to=gary.bisson@boundarydevices.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox