* [U-Boot] [PATCH] cmd: sata: fix init command return value
@ 2017-01-11 15:51 Gary Bisson
2017-01-11 16:28 ` Eric Nelson
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Gary Bisson @ 2017-01-11 15:51 UTC (permalink / raw)
To: u-boot
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
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [U-Boot] [PATCH] cmd: sata: fix init command return value
2017-01-11 15:51 [U-Boot] [PATCH] cmd: sata: fix init command return value Gary Bisson
@ 2017-01-11 16:28 ` Eric Nelson
2017-01-12 5:07 ` Simon Glass
2017-01-15 18:32 ` [U-Boot] " Tom Rini
2 siblings, 0 replies; 4+ messages in thread
From: Eric Nelson @ 2017-01-11 16:28 UTC (permalink / raw)
To: u-boot
On 01/11/2017 08:51 AM, Gary Bisson wrote:
> 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.
s/shoud/should/
>
> 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;
> }
>
>
Otherwise,
Reviewed-by: Eric Nelson <eric@nelint.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* [U-Boot] [PATCH] cmd: sata: fix init command return value
2017-01-11 15:51 [U-Boot] [PATCH] cmd: sata: fix init command return value Gary Bisson
2017-01-11 16:28 ` Eric Nelson
@ 2017-01-12 5:07 ` Simon Glass
2017-01-15 18:32 ` [U-Boot] " Tom Rini
2 siblings, 0 replies; 4+ messages in thread
From: Simon Glass @ 2017-01-12 5:07 UTC (permalink / raw)
To: u-boot
On 11 January 2017 at 08:51, Gary Bisson
<gary.bisson@boundarydevices.com> wrote:
>
> 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(-)
Reviewed-by: Simon Glass <sjg@chromium.org>
^ permalink raw reply [flat|nested] 4+ messages in thread
* [U-Boot] cmd: sata: fix init command return value
2017-01-11 15:51 [U-Boot] [PATCH] cmd: sata: fix init command return value Gary Bisson
2017-01-11 16:28 ` Eric Nelson
2017-01-12 5:07 ` Simon Glass
@ 2017-01-15 18:32 ` Tom Rini
2 siblings, 0 replies; 4+ messages in thread
From: Tom Rini @ 2017-01-15 18:32 UTC (permalink / raw)
To: u-boot
On Wed, Jan 11, 2017 at 04:51:53PM +0100, Gary Bisson wrote:
> 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>
> Reviewed-by: Eric Nelson <eric@nelint.com>
> Reviewed-by: Simon Glass <sjg@chromium.org>
Applied to u-boot/master, thanks!
--
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170115/b4340c86/attachment.sig>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-01-15 18:32 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-01-11 15:51 [U-Boot] [PATCH] cmd: sata: fix init command return value Gary Bisson
2017-01-11 16:28 ` Eric Nelson
2017-01-12 5:07 ` Simon Glass
2017-01-15 18:32 ` [U-Boot] " Tom Rini
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox