linux-snps-arc.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] CMD: random: fix return code
@ 2020-03-20 16:38 Eugeniy Paltsev
  2020-03-23 15:37 ` Simon Glass
  2020-04-28 13:53 ` Tom Rini
  0 siblings, 2 replies; 4+ messages in thread
From: Eugeniy Paltsev @ 2020-03-20 16:38 UTC (permalink / raw)
  To: Tom Rini
  Cc: Simon Glass, Alexey Brodkin, uboot-snps-arc, u-boot,
	linux-snps-arc, Eugeniy Paltsev

As of today 'random' command return 1 (CMD_RET_FAILURE) in case
of successful execution and 0 (CMD_RET_SUCCESS) in case of bad
arguments. Fix that.

NOTE: we remove printing usage information from command body
so it won't print twice.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
---
 cmd/mem.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/cmd/mem.c b/cmd/mem.c
index 6d54f195272..6b4897dfd94 100644
--- a/cmd/mem.c
+++ b/cmd/mem.c
@@ -1102,10 +1102,8 @@ static int do_random(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 	unsigned char *buf8;
 	unsigned int i;
 
-	if (argc < 3 || argc > 4) {
-		printf("usage: %s <addr> <len> [<seed>]\n", argv[0]);
-		return 0;
-	}
+	if (argc < 3 || argc > 4)
+		return CMD_RET_USAGE;
 
 	len = simple_strtoul(argv[2], NULL, 16);
 	addr = simple_strtoul(argv[1], NULL, 16);
@@ -1132,7 +1130,8 @@ static int do_random(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 
 	unmap_sysmem(start);
 	printf("%lu bytes filled with random data\n", len);
-	return 1;
+
+	return CMD_RET_SUCCESS;
 }
 #endif
 
-- 
2.21.1


_______________________________________________
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] CMD: random: fix return code
  2020-03-20 16:38 [PATCH] CMD: random: fix return code Eugeniy Paltsev
@ 2020-03-23 15:37 ` Simon Glass
  2020-04-24 21:20   ` Eugeniy Paltsev
  2020-04-28 13:53 ` Tom Rini
  1 sibling, 1 reply; 4+ messages in thread
From: Simon Glass @ 2020-03-23 15:37 UTC (permalink / raw)
  To: Eugeniy Paltsev
  Cc: Tom Rini, uboot-snps-arc, Alexey Brodkin, linux-snps-arc,
	U-Boot Mailing List

On Fri, 20 Mar 2020 at 10:38, Eugeniy Paltsev
<Eugeniy.Paltsev@synopsys.com> wrote:
>
> As of today 'random' command return 1 (CMD_RET_FAILURE) in case
> of successful execution and 0 (CMD_RET_SUCCESS) in case of bad
> arguments. Fix that.
>
> NOTE: we remove printing usage information from command body
> so it won't print twice.
>
> Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
> ---
>  cmd/mem.c | 9 ++++-----
>  1 file changed, 4 insertions(+), 5 deletions(-)
>

Reviewed-by: Simon Glass <sjg@chromium.org>

_______________________________________________
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] CMD: random: fix return code
  2020-03-23 15:37 ` Simon Glass
@ 2020-04-24 21:20   ` Eugeniy Paltsev
  0 siblings, 0 replies; 4+ messages in thread
From: Eugeniy Paltsev @ 2020-04-24 21:20 UTC (permalink / raw)
  To: Simon Glass, Tom Rini
  Cc: U-Boot Mailing List, Alexey Brodkin, linux-snps-arc, uboot-snps-arc

Hi Simon, Tom,

I guess it's perfect time to apply this patch. Thanks!

---
 Eugeniy Paltsev


________________________________________
From: Simon Glass <sjg@chromium.org>
Sent: Monday, March 23, 2020 18:37
To: Eugeniy Paltsev
Cc: Tom Rini; U-Boot Mailing List; uboot-snps-arc@synopsys.com; Alexey Brodkin; linux-snps-arc@lists.infradead.org
Subject: Re: [PATCH] CMD: random: fix return code

On Fri, 20 Mar 2020 at 10:38, Eugeniy Paltsev
<Eugeniy.Paltsev@synopsys.com> wrote:
>
> As of today 'random' command return 1 (CMD_RET_FAILURE) in case
> of successful execution and 0 (CMD_RET_SUCCESS) in case of bad
> arguments. Fix that.
>
> NOTE: we remove printing usage information from command body
> so it won't print twice.
>
> Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
> ---
>  cmd/mem.c | 9 ++++-----
>  1 file changed, 4 insertions(+), 5 deletions(-)
>

Reviewed-by: Simon Glass <sjg@chromium.org>

_______________________________________________
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] CMD: random: fix return code
  2020-03-20 16:38 [PATCH] CMD: random: fix return code Eugeniy Paltsev
  2020-03-23 15:37 ` Simon Glass
@ 2020-04-28 13:53 ` Tom Rini
  1 sibling, 0 replies; 4+ messages in thread
From: Tom Rini @ 2020-04-28 13:53 UTC (permalink / raw)
  To: Eugeniy Paltsev
  Cc: u-boot, Simon Glass, Alexey Brodkin, linux-snps-arc, uboot-snps-arc


[-- Attachment #1.1: Type: text/plain, Size: 486 bytes --]

On Fri, Mar 20, 2020 at 07:38:17PM +0300, Eugeniy Paltsev wrote:

> As of today 'random' command return 1 (CMD_RET_FAILURE) in case
> of successful execution and 0 (CMD_RET_SUCCESS) in case of bad
> arguments. Fix that.
> 
> NOTE: we remove printing usage information from command body
> so it won't print twice.
> 
> Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
> Reviewed-by: Simon Glass <sjg@chromium.org>

Applied to u-boot/master, thanks!

-- 
Tom

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

[-- Attachment #2: Type: text/plain, Size: 170 bytes --]

_______________________________________________
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-04-28 13:53 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-20 16:38 [PATCH] CMD: random: fix return code Eugeniy Paltsev
2020-03-23 15:37 ` Simon Glass
2020-04-24 21:20   ` Eugeniy Paltsev
2020-04-28 13:53 ` Tom Rini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).