diff mbox series

[u-boot-marvell,12/13] tools: kwboot: Change retry loop from decreasing to increasing

Message ID 20211025131304.21310-13-kabel@kernel.org
State Accepted
Commit d14a342073ca7ed108ca1c2477e102da431a527c
Delegated to: Stefan Roese
Headers show
Series Yet another kwboot improvements | expand

Commit Message

Marek Behún Oct. 25, 2021, 1:13 p.m. UTC
From: Pali Rohár <pali@kernel.org>

This patch does not change behavior of the code, just allows to implement
new changes more easily.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Marek Behún <marek.behun@nic.cz>
---
 tools/kwboot.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Stefan Roese Oct. 26, 2021, 5:49 a.m. UTC | #1
On 25.10.21 15:13, Marek Behún wrote:
> From: Pali Rohár <pali@kernel.org>
> 
> This patch does not change behavior of the code, just allows to implement
> new changes more easily.
> 
> Signed-off-by: Pali Rohár <pali@kernel.org>
> Reviewed-by: Marek Behún <marek.behun@nic.cz>

Reviewed-by: Stefan Roese <sr@denx.de>

Thanks,
Stefan

> ---
>   tools/kwboot.c | 8 ++++----
>   1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/tools/kwboot.c b/tools/kwboot.c
> index 5d7cb7a774..16c5a84825 100644
> --- a/tools/kwboot.c
> +++ b/tools/kwboot.c
> @@ -925,7 +925,7 @@ kwboot_xm_sendblock(int fd, struct kwboot_block *block, int allow_non_xm,
>   
>   	*done_print = 0;
>   
> -	retries = 16;
> +	retries = 0;
>   	do {
>   		rc = kwboot_tty_send(fd, block, sizeof(*block));
>   		if (rc)
> @@ -944,7 +944,7 @@ kwboot_xm_sendblock(int fd, struct kwboot_block *block, int allow_non_xm,
>   
>   		if (!allow_non_xm && c != ACK)
>   			kwboot_progress(-1, '+');
> -	} while (c == NAK && retries-- > 0);
> +	} while (c == NAK && retries++ < 16);
>   
>   	if (non_xm_print)
>   		kwboot_printv("\n");
> @@ -973,7 +973,7 @@ kwboot_xm_finish(int fd)
>   
>   	kwboot_printv("Finishing transfer\n");
>   
> -	retries = 16;
> +	retries = 0;
>   	do {
>   		rc = kwboot_tty_send_char(fd, EOT);
>   		if (rc)
> @@ -982,7 +982,7 @@ kwboot_xm_finish(int fd)
>   		rc = kwboot_xm_recv_reply(fd, &c, 0, NULL, 0, NULL);
>   		if (rc)
>   			return rc;
> -	} while (c == NAK && retries-- > 0);
> +	} while (c == NAK && retries++ < 16);
>   
>   	return _xm_reply_to_error(c);
>   }
> 


Viele Grüße,
Stefan
diff mbox series

Patch

diff --git a/tools/kwboot.c b/tools/kwboot.c
index 5d7cb7a774..16c5a84825 100644
--- a/tools/kwboot.c
+++ b/tools/kwboot.c
@@ -925,7 +925,7 @@  kwboot_xm_sendblock(int fd, struct kwboot_block *block, int allow_non_xm,
 
 	*done_print = 0;
 
-	retries = 16;
+	retries = 0;
 	do {
 		rc = kwboot_tty_send(fd, block, sizeof(*block));
 		if (rc)
@@ -944,7 +944,7 @@  kwboot_xm_sendblock(int fd, struct kwboot_block *block, int allow_non_xm,
 
 		if (!allow_non_xm && c != ACK)
 			kwboot_progress(-1, '+');
-	} while (c == NAK && retries-- > 0);
+	} while (c == NAK && retries++ < 16);
 
 	if (non_xm_print)
 		kwboot_printv("\n");
@@ -973,7 +973,7 @@  kwboot_xm_finish(int fd)
 
 	kwboot_printv("Finishing transfer\n");
 
-	retries = 16;
+	retries = 0;
 	do {
 		rc = kwboot_tty_send_char(fd, EOT);
 		if (rc)
@@ -982,7 +982,7 @@  kwboot_xm_finish(int fd)
 		rc = kwboot_xm_recv_reply(fd, &c, 0, NULL, 0, NULL);
 		if (rc)
 			return rc;
-	} while (c == NAK && retries-- > 0);
+	} while (c == NAK && retries++ < 16);
 
 	return _xm_reply_to_error(c);
 }