diff mbox series

[v2,1/2] net: Fix the displayed value of bytes transferred

Message ID 20230814045348.49105-2-s-vadapalli@ti.com
State Accepted
Commit 8f911a7be6bc631d2f4185f7d71025bf97f260e9
Delegated to: Tom Rini
Headers show
Series Fix format specifier for net_boot_file_size | expand

Commit Message

Siddharth Vadapalli Aug. 14, 2023, 4:53 a.m. UTC
In the case of NETLOOP_SUCCESS, the decimal value of the u32 variable
"net_boot_file_size" is printed using "%d", resulting in negative values
being reported for large file sizes. Fix this by using "%u" to print the
decimal value corresponding to the bytes transferred.

Fixes: 1411157d8578 ("net: cosmetic: Fixup var names related to boot file")
Signed-off-by: Siddharth Vadapalli <s-vadapalli@ti.com>
---
 net/net.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Tom Rini Aug. 14, 2023, 3:03 p.m. UTC | #1
On Mon, Aug 14, 2023 at 10:23:47AM +0530, Siddharth Vadapalli wrote:

> In the case of NETLOOP_SUCCESS, the decimal value of the u32 variable
> "net_boot_file_size" is printed using "%d", resulting in negative values
> being reported for large file sizes. Fix this by using "%u" to print the
> decimal value corresponding to the bytes transferred.
> 
> Fixes: 1411157d8578 ("net: cosmetic: Fixup var names related to boot file")
> Signed-off-by: Siddharth Vadapalli <s-vadapalli@ti.com>

Reviewed-by: Tom Rini <trini@konsulko.com>
Tom Rini Aug. 23, 2023, 2:42 p.m. UTC | #2
On Mon, Aug 14, 2023 at 10:23:47AM +0530, Siddharth Vadapalli wrote:

> In the case of NETLOOP_SUCCESS, the decimal value of the u32 variable
> "net_boot_file_size" is printed using "%d", resulting in negative values
> being reported for large file sizes. Fix this by using "%u" to print the
> decimal value corresponding to the bytes transferred.
> 
> Fixes: 1411157d8578 ("net: cosmetic: Fixup var names related to boot file")
> Signed-off-by: Siddharth Vadapalli <s-vadapalli@ti.com>
> Reviewed-by: Tom Rini <trini@konsulko.com>

Applied to u-boot/next, thanks!
diff mbox series

Patch

diff --git a/net/net.c b/net/net.c
index 43abbac7c3..e6f61f0f8f 100644
--- a/net/net.c
+++ b/net/net.c
@@ -716,7 +716,7 @@  restart:
 		case NETLOOP_SUCCESS:
 			net_cleanup_loop();
 			if (net_boot_file_size > 0) {
-				printf("Bytes transferred = %d (%x hex)\n",
+				printf("Bytes transferred = %u (%x hex)\n",
 				       net_boot_file_size, net_boot_file_size);
 				env_set_hex("filesize", net_boot_file_size);
 				env_set_hex("fileaddr", image_load_addr);