* [PATCH v2 0/2] Fix format specifier for net_boot_file_size
@ 2023-08-14 4:53 Siddharth Vadapalli
2023-08-14 4:53 ` [PATCH v2 1/2] net: Fix the displayed value of bytes transferred Siddharth Vadapalli
2023-08-14 4:53 ` [PATCH v2 2/2] doc: printf() codes: Fix format specifier for unsigned int Siddharth Vadapalli
0 siblings, 2 replies; 6+ messages in thread
From: Siddharth Vadapalli @ 2023-08-14 4:53 UTC (permalink / raw)
To: trini, joe.hershberger, rfried.dev, sjg
Cc: u-boot, r-gunasekaran, s-vadapalli
Hello,
This series fixes the format specifier for printing the decimal value of
the variable "net_boot_file_size", changing it from "%d" to "%u". With
the format specifier being "%d", for large file sizes, the value
displayed is negative. Using "%u" fixes this.
Additionally, as reported by Tom Rini <trini@konsulko.com> in the mail
thread corresponding to the v1 patch of this series, the documentation
for the printf format specifiers needs to be fixed for the "unsigned
int" variable. Thus, update the documentation as well.
Regards,
Siddharth.
---
v1:
https://patchwork.ozlabs.org/project/uboot/patch/20230810091523.3168975-1-s-vadapalli@ti.com/
Changes since v1:
- Use "%u" instead of "%lu" to display the decimal value of the u32
variable "net_boot_file_size", as suggested by Tom Rini.
- Add a new patch to update the documentation for printf format
specifiers, changing the format specifier from "%d" to "%u" for the
"unsigned int" variable, as reported by Tom Rini.
Siddharth Vadapalli (2):
net: Fix the displayed value of bytes transferred
doc: printf() codes: Fix format specifier for unsigned int
doc/develop/printf.rst | 2 +-
net/net.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
--
2.34.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v2 1/2] net: Fix the displayed value of bytes transferred
2023-08-14 4:53 [PATCH v2 0/2] Fix format specifier for net_boot_file_size Siddharth Vadapalli
@ 2023-08-14 4:53 ` Siddharth Vadapalli
2023-08-14 15:03 ` Tom Rini
2023-08-23 14:42 ` Tom Rini
2023-08-14 4:53 ` [PATCH v2 2/2] doc: printf() codes: Fix format specifier for unsigned int Siddharth Vadapalli
1 sibling, 2 replies; 6+ messages in thread
From: Siddharth Vadapalli @ 2023-08-14 4:53 UTC (permalink / raw)
To: trini, joe.hershberger, rfried.dev, sjg
Cc: u-boot, r-gunasekaran, s-vadapalli
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(-)
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);
--
2.34.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v2 2/2] doc: printf() codes: Fix format specifier for unsigned int
2023-08-14 4:53 [PATCH v2 0/2] Fix format specifier for net_boot_file_size Siddharth Vadapalli
2023-08-14 4:53 ` [PATCH v2 1/2] net: Fix the displayed value of bytes transferred Siddharth Vadapalli
@ 2023-08-14 4:53 ` Siddharth Vadapalli
2023-08-14 15:04 ` Tom Rini
1 sibling, 1 reply; 6+ messages in thread
From: Siddharth Vadapalli @ 2023-08-14 4:53 UTC (permalink / raw)
To: trini, joe.hershberger, rfried.dev, sjg
Cc: u-boot, r-gunasekaran, s-vadapalli
The format specifier for the "unsigned int" variable is documented as
"%d". However, it should be "%u". Thus, fix it.
Fixes: f5e9035043fb ("doc: printf() codes")
Reported-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Siddharth Vadapalli <s-vadapalli@ti.com>
---
doc/develop/printf.rst | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/doc/develop/printf.rst b/doc/develop/printf.rst
index 7b9aea0687..05909a1f22 100644
--- a/doc/develop/printf.rst
+++ b/doc/develop/printf.rst
@@ -111,7 +111,7 @@ unsigned char %u, %x
short %d, %x
unsigned short %u, %x
int %d, %x
-unsigned int %d, %x
+unsigned int %u, %x
long %ld, %lx
unsigned long %lu, %lx
long long %lld, %llx
--
2.34.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v2 1/2] net: Fix the displayed value of bytes transferred
2023-08-14 4:53 ` [PATCH v2 1/2] net: Fix the displayed value of bytes transferred Siddharth Vadapalli
@ 2023-08-14 15:03 ` Tom Rini
2023-08-23 14:42 ` Tom Rini
1 sibling, 0 replies; 6+ messages in thread
From: Tom Rini @ 2023-08-14 15:03 UTC (permalink / raw)
To: Siddharth Vadapalli
Cc: joe.hershberger, rfried.dev, sjg, u-boot, r-gunasekaran
[-- Attachment #1: Type: text/plain, Size: 554 bytes --]
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
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 2/2] doc: printf() codes: Fix format specifier for unsigned int
2023-08-14 4:53 ` [PATCH v2 2/2] doc: printf() codes: Fix format specifier for unsigned int Siddharth Vadapalli
@ 2023-08-14 15:04 ` Tom Rini
0 siblings, 0 replies; 6+ messages in thread
From: Tom Rini @ 2023-08-14 15:04 UTC (permalink / raw)
To: Siddharth Vadapalli
Cc: joe.hershberger, rfried.dev, sjg, u-boot, r-gunasekaran
[-- Attachment #1: Type: text/plain, Size: 410 bytes --]
On Mon, Aug 14, 2023 at 10:23:48AM +0530, Siddharth Vadapalli wrote:
> The format specifier for the "unsigned int" variable is documented as
> "%d". However, it should be "%u". Thus, fix it.
>
> Fixes: f5e9035043fb ("doc: printf() codes")
> Reported-by: Tom Rini <trini@konsulko.com>
> Signed-off-by: Siddharth Vadapalli <s-vadapalli@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
--
Tom
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 1/2] net: Fix the displayed value of bytes transferred
2023-08-14 4:53 ` [PATCH v2 1/2] net: Fix the displayed value of bytes transferred Siddharth Vadapalli
2023-08-14 15:03 ` Tom Rini
@ 2023-08-23 14:42 ` Tom Rini
1 sibling, 0 replies; 6+ messages in thread
From: Tom Rini @ 2023-08-23 14:42 UTC (permalink / raw)
To: Siddharth Vadapalli
Cc: joe.hershberger, rfried.dev, sjg, u-boot, r-gunasekaran
[-- Attachment #1: Type: text/plain, Size: 589 bytes --]
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!
--
Tom
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2023-08-23 14:44 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-14 4:53 [PATCH v2 0/2] Fix format specifier for net_boot_file_size Siddharth Vadapalli
2023-08-14 4:53 ` [PATCH v2 1/2] net: Fix the displayed value of bytes transferred Siddharth Vadapalli
2023-08-14 15:03 ` Tom Rini
2023-08-23 14:42 ` Tom Rini
2023-08-14 4:53 ` [PATCH v2 2/2] doc: printf() codes: Fix format specifier for unsigned int Siddharth Vadapalli
2023-08-14 15:04 ` Tom Rini
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox