diff mbox series

[1/1] lmb.c: add missing comma in lmb_dump_region()

Message ID 20241102064127.41571-1-heinrich.schuchardt@canonical.com
State Changes Requested
Delegated to: Heinrich Schuchardt
Headers show
Series [1/1] lmb.c: add missing comma in lmb_dump_region() | expand

Commit Message

Heinrich Schuchardt Nov. 2, 2024, 6:41 a.m. UTC
In the message string " %s[%d]\t[0x%llx-0x%llx], 0x%08llx bytes flags: "
a comma is missing before flags.

To avoid increasing the code size replace '0x%' by '%#'.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
---
 lib/lmb.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Ilias Apalodimas Nov. 7, 2024, 9:56 a.m. UTC | #1
On Sat, 2 Nov 2024 at 06:41, Heinrich Schuchardt
<heinrich.schuchardt@canonical.com> wrote:
>
> In the message string " %s[%d]\t[0x%llx-0x%llx], 0x%08llx bytes flags: "
> a comma is missing before flags.
>
> To avoid increasing the code size replace '0x%' by '%#'.
>
> Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
> ---
>  lib/lmb.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/lib/lmb.c b/lib/lmb.c
> index 00c8888936a..95adf2e93a4 100644
> --- a/lib/lmb.c
> +++ b/lib/lmb.c
> @@ -97,7 +97,7 @@ static void lmb_dump_region(struct alist *lmb_rgn_lst, char *name)
>         enum lmb_flags flags;
>         int i;
>
> -       printf(" %s.count = 0x%x\n", name, lmb_rgn_lst->count);
> +       printf(" %s.count = %#x\n", name, lmb_rgn_lst->count);
>
>         for (i = 0; i < lmb_rgn_lst->count; i++) {
>                 base = rgn[i].base;
> @@ -105,7 +105,7 @@ static void lmb_dump_region(struct alist *lmb_rgn_lst, char *name)
>                 end = base + size - 1;
>                 flags = rgn[i].flags;
>
> -               printf(" %s[%d]\t[0x%llx-0x%llx], 0x%08llx bytes flags: ",
> +               printf(" %s[%d]\t[%#llx-%#llx], %#08llx bytes, flags: ",
>                        name, i, base, end, size);
>                 lmb_print_region_flags(flags);
>         }
> --
> 2.45.2
>

Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Heinrich Schuchardt Nov. 7, 2024, 10:07 a.m. UTC | #2
On 11/7/24 10:56, Ilias Apalodimas wrote:
> On Sat, 2 Nov 2024 at 06:41, Heinrich Schuchardt
> <heinrich.schuchardt@canonical.com> wrote:
>>
>> In the message string " %s[%d]\t[0x%llx-0x%llx], 0x%08llx bytes flags: "
>> a comma is missing before flags.
>>
>> To avoid increasing the code size replace '0x%' by '%#'.
>>
>> Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
>> ---
>>   lib/lmb.c | 4 ++--
>>   1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/lib/lmb.c b/lib/lmb.c
>> index 00c8888936a..95adf2e93a4 100644
>> --- a/lib/lmb.c
>> +++ b/lib/lmb.c
>> @@ -97,7 +97,7 @@ static void lmb_dump_region(struct alist *lmb_rgn_lst, char *name)
>>          enum lmb_flags flags;
>>          int i;
>>
>> -       printf(" %s.count = 0x%x\n", name, lmb_rgn_lst->count);
>> +       printf(" %s.count = %#x\n", name, lmb_rgn_lst->count);
>>
>>          for (i = 0; i < lmb_rgn_lst->count; i++) {
>>                  base = rgn[i].base;
>> @@ -105,7 +105,7 @@ static void lmb_dump_region(struct alist *lmb_rgn_lst, char *name)
>>                  end = base + size - 1;
>>                  flags = rgn[i].flags;
>>
>> -               printf(" %s[%d]\t[0x%llx-0x%llx], 0x%08llx bytes flags: ",
>> +               printf(" %s[%d]\t[%#llx-%#llx], %#08llx bytes, flags: ",

If we use #, we have to increase the size (8) by two to get the same 
output. But why have leading zeros for the size if we have none for the 
addresses?

Let's drop the 08. Allocations of more than 4 GiB anyway would not fit 
into 8 digits.

Best regards

Heinrich

>>                         name, i, base, end, size);
>>                  lmb_print_region_flags(flags);
>>          }
>> --
>> 2.45.2
>>
> 
> Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
diff mbox series

Patch

diff --git a/lib/lmb.c b/lib/lmb.c
index 00c8888936a..95adf2e93a4 100644
--- a/lib/lmb.c
+++ b/lib/lmb.c
@@ -97,7 +97,7 @@  static void lmb_dump_region(struct alist *lmb_rgn_lst, char *name)
 	enum lmb_flags flags;
 	int i;
 
-	printf(" %s.count = 0x%x\n", name, lmb_rgn_lst->count);
+	printf(" %s.count = %#x\n", name, lmb_rgn_lst->count);
 
 	for (i = 0; i < lmb_rgn_lst->count; i++) {
 		base = rgn[i].base;
@@ -105,7 +105,7 @@  static void lmb_dump_region(struct alist *lmb_rgn_lst, char *name)
 		end = base + size - 1;
 		flags = rgn[i].flags;
 
-		printf(" %s[%d]\t[0x%llx-0x%llx], 0x%08llx bytes flags: ",
+		printf(" %s[%d]\t[%#llx-%#llx], %#08llx bytes, flags: ",
 		       name, i, base, end, size);
 		lmb_print_region_flags(flags);
 	}