diff mbox

[U-Boot] disk: Fixed capacity message

Message ID 1482486343-12024-1-git-send-email-jjhiblot@ti.com
State Accepted
Commit 139f7b1ded58366e8d328c1dd49bcbe1fc08b24c
Delegated to: Tom Rini
Headers show

Commit Message

Jean-Jacques Hiblot Dec. 23, 2016, 9:45 a.m. UTC
With capacities getting bigger, we can see see messages with negative
numbers like "Capacity: 1907729.0 MB = 1863.0 GB (-387938128 x 512)".
Here the printed LBA is -387938128 when it should have been 3907029168.
To fix this, use the right format when displaying the unsigned integers.

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reported-by: Yan Liu <yan-liu@ti.com>
---
 disk/part.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Tom Rini Dec. 29, 2016, 10:39 p.m. UTC | #1
On Fri, Dec 23, 2016 at 10:45:43AM +0100, Jean-Jacques Hiblot wrote:

> With capacities getting bigger, we can see see messages with negative
> numbers like "Capacity: 1907729.0 MB = 1863.0 GB (-387938128 x 512)".
> Here the printed LBA is -387938128 when it should have been 3907029168.
> To fix this, use the right format when displaying the unsigned integers.
> 
> Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
> Reported-by: Yan Liu <yan-liu@ti.com>

Applied to u-boot/master, thanks!
diff mbox

Patch

diff --git a/disk/part.c b/disk/part.c
index 543cab8..d93a643 100644
--- a/disk/part.c
+++ b/disk/part.c
@@ -241,13 +241,13 @@  void dev_print (struct blk_desc *dev_desc)
 			printf ("            Supports 48-bit addressing\n");
 #endif
 #if defined(CONFIG_SYS_64BIT_LBA)
-		printf ("            Capacity: %ld.%ld MB = %ld.%ld GB (%Ld x %ld)\n",
+		printf ("            Capacity: %lu.%lu MB = %lu.%lu GB (%llu x %lu)\n",
 			mb_quot, mb_rem,
 			gb_quot, gb_rem,
 			lba,
 			dev_desc->blksz);
 #else
-		printf ("            Capacity: %ld.%ld MB = %ld.%ld GB (%ld x %ld)\n",
+		printf ("            Capacity: %lu.%lu MB = %lu.%lu GB (%lu x %lu)\n",
 			mb_quot, mb_rem,
 			gb_quot, gb_rem,
 			(ulong)lba,