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

[xen staging] common/efi: fix Rule 2.1 violation in read_file()



commit 9e5a9b53f65058b095c2e6e44afeb50a0fc81eef
Author:     Dmytro Prokopchuk <dmytro_prokopchuk1@xxxxxxxx>
AuthorDate: Mon Aug 25 12:52:03 2025 +0200
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Mon Aug 25 12:52:03 2025 +0200

    common/efi: fix Rule 2.1 violation in read_file()
    
    MISRA C Rule 2.1 states: "A project shall not contain unreachable code."
    
    The final return statement in the 'read_file()' function is unreachable
    due to function 'PrintErrMesg()' which has 'noreturn' attribute:
            PrintErrMesg(name, ret);
            /* not reached */
            return false;
        }
    
    No explicit return statement is needed here because 'PrintErrMesg()' is
    marked as 'noreturn', which guarantees that it never returns control to
    the caller. If the 'noreturn' attribute of 'PrintErrMesg()' is removed
    in the future, compiler will emit an error about the missing return
    statement (build-time safeguard).
    No functional changes.
    
    Signed-off-by: Dmytro Prokopchuk <dmytro_prokopchuk1@xxxxxxxx>
    Reviewed-by: Marek Marczykowski-Górecki <marmarek@xxxxxxxxxxxxxxxxxxxxxx>
---
 xen/common/efi/boot.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/xen/common/efi/boot.c b/xen/common/efi/boot.c
index 50ff1d1bd2..b7fdb031d0 100644
--- a/xen/common/efi/boot.c
+++ b/xen/common/efi/boot.c
@@ -853,7 +853,6 @@ static bool __init read_file(EFI_FILE_HANDLE dir_handle, 
CHAR16 *name,
     PrintErrMesg(name, ret);
 
     /* not reached */
-    return false;
 }
 
 static bool __init read_section(const EFI_LOADED_IMAGE *image,
--
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®.