3990aa95a7001a2d4f8a8dcbda2ab868b5e576ae
[openwrt/openwrt.git] / package / boot / uboot-oxnas / patches / 010-capacity-is-unsigned.patch
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
7 Large disks otherwise produce highly unplausible output such as
8 Capacity: 1907729.0 MB = 1863.0 GB (-387938128 x 512)
9
10 As supposedly all size-related decimals are unsigned, use unsigned
11 format in printf statement, resulting in a correct capacity being
12 displayed:
13 Capacity: 1907729.0 MB = 1863.0 GB (3907029168 x 512)
14
15 Signed-off-by: Daniel Golle <daniel@makrotopia.org>
16 ---
17 disk/part.c | 4 ++--
18 1 file changed, 2 insertions(+), 2 deletions(-)
19
20 diff --git a/disk/part.c b/disk/part.c
21 index 43485c9..7c67ea6 100644
22 --- a/disk/part.c
23 +++ b/disk/part.c
24 @@ -229,13 +229,13 @@ void dev_print (block_dev_desc_t *dev_desc)
25 printf (" Supports 48-bit addressing\n");
26 #endif
27 #if defined(CONFIG_SYS_64BIT_LBA)
28 - printf (" Capacity: %ld.%ld MB = %ld.%ld GB (%Ld x %ld)\n",
29 + printf (" Capacity: %lu.%lu MB = %lu.%lu GB (%Lu x %lu)\n",
30 mb_quot, mb_rem,
31 gb_quot, gb_rem,
32 lba,
33 dev_desc->blksz);
34 #else
35 - printf (" Capacity: %ld.%ld MB = %ld.%ld GB (%ld x %ld)\n",
36 + printf (" Capacity: %lu.%lu MB = %lu.%lu GB (%lu x %lu)\n",
37 mb_quot, mb_rem,
38 gb_quot, gb_rem,
39 (ulong)lba,
40 --
41 2.1.3
42