All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] arm64/EFI: minor corrections
@ 2015-01-12  8:59 Jan Beulich
  2015-01-12 13:46 ` Ian Campbell
  0 siblings, 1 reply; 3+ messages in thread
From: Jan Beulich @ 2015-01-12  8:59 UTC (permalink / raw)
  To: xen-devel; +Cc: Ian Campbell, roy.franz, Tim Deegan, Stefano Stabellini

[-- Attachment #1: Type: text/plain, Size: 2563 bytes --]

- don't bail when using the last slot of bootinfo.mem.bank[] (due to
  premature incrementing of the array index)
- GUIDs should be static const (and placed into .init.* whenever
  possible)
- PrintErrMsg() issues a CR/LF pair itself - no need to explicitly
  append one to the message passed to the function

Signed-off-by: Jan Beulich <jbeulich@suse.com>

--- a/xen/arch/arm/efi/efi-boot.h
+++ b/xen/arch/arm/efi/efi-boot.h
@@ -104,7 +104,7 @@ static int __init fdt_set_reg(void *fdt,
 
 static void __init *lookup_fdt_config_table(EFI_SYSTEM_TABLE *sys_table)
 {
-    const EFI_GUID fdt_guid = DEVICE_TREE_GUID;
+    static const EFI_GUID __initconst fdt_guid = DEVICE_TREE_GUID;
     EFI_CONFIGURATION_TABLE *tables;
     void *fdt = NULL;
     int i;
@@ -135,15 +135,15 @@ static EFI_STATUS __init efi_process_mem
              || desc_ptr->Type == EfiBootServicesCode
              || desc_ptr->Type == EfiBootServicesData )
         {
-            bootinfo.mem.bank[i].start = desc_ptr->PhysicalStart;
-            bootinfo.mem.bank[i].size = desc_ptr->NumberOfPages * EFI_PAGE_SIZE;
-            if ( ++i >= NR_MEM_BANKS )
+            if ( i >= NR_MEM_BANKS )
             {
-                PrintStr(L"Warning: All ");
-                DisplayUint(NR_MEM_BANKS, -1);
-                PrintStr(L" bootinfo mem banks exhausted.\r\n");
+                PrintStr(L"Warning: All " __stringify(NR_MEM_BANKS)
+                          " bootinfo mem banks exhausted.\r\n");
                 break;
             }
+            bootinfo.mem.bank[i].start = desc_ptr->PhysicalStart;
+            bootinfo.mem.bank[i].size = desc_ptr->NumberOfPages * EFI_PAGE_SIZE;
+            ++i;
         }
         desc_ptr = NextMemoryDescriptor(desc_ptr, desc_size);
     }
@@ -334,7 +334,7 @@ static void __init efi_arch_process_memo
     status = fdt_add_uefi_nodes(SystemTable, fdt, map, map_size, desc_size,
                                 desc_ver);
     if ( EFI_ERROR(status) )
-        PrintErrMesg(L"Updating FDT failed\r\n", status);
+        PrintErrMesg(L"Updating FDT failed", status);
 }
 
 static void __init efi_arch_pre_exit_boot(void)
@@ -408,7 +408,7 @@ static void __init efi_arch_handle_cmdli
 
     status = efi_bs->AllocatePool(EfiBootServicesData, EFI_PAGE_SIZE, (void **)&buf);
     if ( EFI_ERROR(status) )
-        PrintErrMesg(L"Unable to allocate string buffer\r\n", status);
+        PrintErrMesg(L"Unable to allocate string buffer", status);
 
     if ( image_name )
     {




[-- Attachment #2: arm64-EFI-cleanup.patch --]
[-- Type: text/plain, Size: 2589 bytes --]

arm64/EFI: minor corrections

- don't bail when using the last slot of bootinfo.mem.bank[] (due to
  premature incrementing of the array index)
- GUIDs should be static const (and placed into .init.* whenever
  possible)
- PrintErrMsg() issues a CR/LF pair itself - no need to explicitly
  append one to the message passed to the function

Signed-off-by: Jan Beulich <jbeulich@suse.com>

--- a/xen/arch/arm/efi/efi-boot.h
+++ b/xen/arch/arm/efi/efi-boot.h
@@ -104,7 +104,7 @@ static int __init fdt_set_reg(void *fdt,
 
 static void __init *lookup_fdt_config_table(EFI_SYSTEM_TABLE *sys_table)
 {
-    const EFI_GUID fdt_guid = DEVICE_TREE_GUID;
+    static const EFI_GUID __initconst fdt_guid = DEVICE_TREE_GUID;
     EFI_CONFIGURATION_TABLE *tables;
     void *fdt = NULL;
     int i;
@@ -135,15 +135,15 @@ static EFI_STATUS __init efi_process_mem
              || desc_ptr->Type == EfiBootServicesCode
              || desc_ptr->Type == EfiBootServicesData )
         {
-            bootinfo.mem.bank[i].start = desc_ptr->PhysicalStart;
-            bootinfo.mem.bank[i].size = desc_ptr->NumberOfPages * EFI_PAGE_SIZE;
-            if ( ++i >= NR_MEM_BANKS )
+            if ( i >= NR_MEM_BANKS )
             {
-                PrintStr(L"Warning: All ");
-                DisplayUint(NR_MEM_BANKS, -1);
-                PrintStr(L" bootinfo mem banks exhausted.\r\n");
+                PrintStr(L"Warning: All " __stringify(NR_MEM_BANKS)
+                          " bootinfo mem banks exhausted.\r\n");
                 break;
             }
+            bootinfo.mem.bank[i].start = desc_ptr->PhysicalStart;
+            bootinfo.mem.bank[i].size = desc_ptr->NumberOfPages * EFI_PAGE_SIZE;
+            ++i;
         }
         desc_ptr = NextMemoryDescriptor(desc_ptr, desc_size);
     }
@@ -334,7 +334,7 @@ static void __init efi_arch_process_memo
     status = fdt_add_uefi_nodes(SystemTable, fdt, map, map_size, desc_size,
                                 desc_ver);
     if ( EFI_ERROR(status) )
-        PrintErrMesg(L"Updating FDT failed\r\n", status);
+        PrintErrMesg(L"Updating FDT failed", status);
 }
 
 static void __init efi_arch_pre_exit_boot(void)
@@ -408,7 +408,7 @@ static void __init efi_arch_handle_cmdli
 
     status = efi_bs->AllocatePool(EfiBootServicesData, EFI_PAGE_SIZE, (void **)&buf);
     if ( EFI_ERROR(status) )
-        PrintErrMesg(L"Unable to allocate string buffer\r\n", status);
+        PrintErrMesg(L"Unable to allocate string buffer", status);
 
     if ( image_name )
     {

[-- Attachment #3: Type: text/plain, Size: 126 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] arm64/EFI: minor corrections
  2015-01-12  8:59 [PATCH] arm64/EFI: minor corrections Jan Beulich
@ 2015-01-12 13:46 ` Ian Campbell
  2015-01-12 13:59   ` Jan Beulich
  0 siblings, 1 reply; 3+ messages in thread
From: Ian Campbell @ 2015-01-12 13:46 UTC (permalink / raw)
  To: Jan Beulich; +Cc: roy.franz, xen-devel, Tim Deegan, Stefano Stabellini

On Mon, 2015-01-12 at 08:59 +0000, Jan Beulich wrote:
> - don't bail when using the last slot of bootinfo.mem.bank[] (due to
>   premature incrementing of the array index)
> - GUIDs should be static const (and placed into .init.* whenever
>   possible)
> - PrintErrMsg() issues a CR/LF pair itself - no need to explicitly
>   append one to the message passed to the function
  - Avoid needless use of DisplayUint via __stringify.

> Signed-off-by: Jan Beulich <jbeulich@suse.com>

Acked-by: Ian Campbell <ian.campbell@citrix.com>

Will you commit yourself or would you like me to?

Ian.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] arm64/EFI: minor corrections
  2015-01-12 13:46 ` Ian Campbell
@ 2015-01-12 13:59   ` Jan Beulich
  0 siblings, 0 replies; 3+ messages in thread
From: Jan Beulich @ 2015-01-12 13:59 UTC (permalink / raw)
  To: Ian Campbell; +Cc: roy.franz, xen-devel, Tim Deegan, Stefano Stabellini

>>> On 12.01.15 at 14:46, <Ian.Campbell@eu.citrix.com> wrote:
> On Mon, 2015-01-12 at 08:59 +0000, Jan Beulich wrote:
>> - don't bail when using the last slot of bootinfo.mem.bank[] (due to
>>   premature incrementing of the array index)
>> - GUIDs should be static const (and placed into .init.* whenever
>>   possible)
>> - PrintErrMsg() issues a CR/LF pair itself - no need to explicitly
>>   append one to the message passed to the function
>   - Avoid needless use of DisplayUint via __stringify.
> 
>> Signed-off-by: Jan Beulich <jbeulich@suse.com>
> 
> Acked-by: Ian Campbell <ian.campbell@citrix.com>
> 
> Will you commit yourself or would you like me to?

I will.

Jan

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-01-12 13:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-12  8:59 [PATCH] arm64/EFI: minor corrections Jan Beulich
2015-01-12 13:46 ` Ian Campbell
2015-01-12 13:59   ` Jan Beulich

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.