010-capacity-is-unsigned.patch 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. From df9fb90120423c4c55b66a5dc09af23f605a406b Mon Sep 17 00:00:00 2001
  2. From: Daniel Golle <daniel@makrotopia.org>
  3. Date: Mon, 1 Dec 2014 21:37:25 +0100
  4. Subject: [PATCH] disk/part.c: use unsigned format when printing capacity
  5. To: u-boot@lists.denx.de
  6. Large disks otherwise produce highly unplausible output such as
  7. Capacity: 1907729.0 MB = 1863.0 GB (-387938128 x 512)
  8. As supposedly all size-related decimals are unsigned, use unsigned
  9. format in printf statement, resulting in a correct capacity being
  10. displayed:
  11. Capacity: 1907729.0 MB = 1863.0 GB (3907029168 x 512)
  12. Signed-off-by: Daniel Golle <daniel@makrotopia.org>
  13. ---
  14. disk/part.c | 4 ++--
  15. 1 file changed, 2 insertions(+), 2 deletions(-)
  16. --- a/disk/part.c
  17. +++ b/disk/part.c
  18. @@ -229,13 +229,13 @@ void dev_print (block_dev_desc_t *dev_de
  19. printf (" Supports 48-bit addressing\n");
  20. #endif
  21. #if defined(CONFIG_SYS_64BIT_LBA)
  22. - printf (" Capacity: %ld.%ld MB = %ld.%ld GB (%Ld x %ld)\n",
  23. + printf (" Capacity: %lu.%lu MB = %lu.%lu GB (%Lu x %lu)\n",
  24. mb_quot, mb_rem,
  25. gb_quot, gb_rem,
  26. lba,
  27. dev_desc->blksz);
  28. #else
  29. - printf (" Capacity: %ld.%ld MB = %ld.%ld GB (%ld x %ld)\n",
  30. + printf (" Capacity: %lu.%lu MB = %lu.%lu GB (%lu x %lu)\n",
  31. mb_quot, mb_rem,
  32. gb_quot, gb_rem,
  33. (ulong)lba,