[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[xen staging] xen/efi: Reduce variable scope to avoid compiler warning



commit a492ec7b01eebd7df2bdda90e2e7d1cf2e2c47ba
Author:     Frediano Ziglio <frediano.ziglio@xxxxxxxxx>
AuthorDate: Wed Jul 30 10:44:19 2025 +0200
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Wed Jul 30 12:03:59 2025 +0200

    xen/efi: Reduce variable scope to avoid compiler warning
    
    This change removes some piece of code working around with
    some compiler warnings.
    No functional change.
    
    Signed-off-by: Frediano Ziglio <frediano.ziglio@xxxxxxxxx>
    Acked-by: Marek Marczykowski-Górecki <marmarek@xxxxxxxxxxxxxxxxxxxxxx>
---
 xen/common/efi/boot.c | 15 ++++-----------
 1 file changed, 4 insertions(+), 11 deletions(-)

diff --git a/xen/common/efi/boot.c b/xen/common/efi/boot.c
index 4b60bd719e..778a39cc48 100644
--- a/xen/common/efi/boot.c
+++ b/xen/common/efi/boot.c
@@ -1313,8 +1313,8 @@ void EFIAPI __init noreturn efi_start(EFI_HANDLE 
ImageHandle,
     static EFI_GUID __initdata shim_lock_guid = SHIM_LOCK_PROTOCOL_GUID;
     EFI_LOADED_IMAGE *loaded_image;
     EFI_STATUS status;
-    unsigned int i, argc;
-    CHAR16 **argv, *file_name, *cfg_file_name = NULL, *options = NULL;
+    unsigned int i;
+    CHAR16 *file_name, *cfg_file_name = NULL, *options = NULL;
     UINTN gop_mode = ~0;
     EFI_SHIM_LOCK_PROTOCOL *shim_lock;
     EFI_GRAPHICS_OUTPUT_PROTOCOL *gop = NULL;
@@ -1345,6 +1345,8 @@ void EFIAPI __init noreturn efi_start(EFI_HANDLE 
ImageHandle,
 
     if ( use_cfg_file )
     {
+        unsigned int argc;
+        CHAR16 **argv;
         UINTN offset = 0;
 
         argc = get_argv(0, NULL, loaded_image->LoadOptions,
@@ -1398,15 +1400,6 @@ void EFIAPI __init noreturn efi_start(EFI_HANDLE 
ImageHandle,
         if ( !base_video )
             efi_console_set_mode();
     }
-    else
-    {
-        /*
-         * Some compilers may emit a false "uninitialized use" warning for 
argc,
-         * so initialize argc/argv here to avoid the warning.
-         */
-        argc = 0;
-        argv = NULL;
-    }
 
     PrintStr(L"Xen " XEN_VERSION_STRING XEN_EXTRAVERSION
             " (c/s " XEN_CHANGESET ") EFI loader\r\n");
--
generated by git-patchbot for /home/xen/git/xen.git#staging



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.