From 9e5a9b53f65058b095c2e6e44afeb50a0fc81eef Mon Sep 17 00:00:00 2001 From: Dmytro Prokopchuk Date: Mon, 25 Aug 2025 12:52:03 +0200 Subject: [PATCH] common/efi: fix Rule 2.1 violation in read_file() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Marek Marczykowski-Górecki --- 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,