MISRA C Rule 2.1 states: "A project shall not contain unreachable code."
The return statements 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. Remove the statement and write a justification comment instead. No functional changes. Signed-off-by: Dmytro Prokopchuk <dmytro_prokopch...@epam.com> --- Link to v2: https://patchew.org/Xen/c20a58f24875806adfaf491f9c6eef2ca8682d18.1755711594.git.dmytro._5fprokopch...@epam.com/ Changes in v3: - removed unreachable code instead of deviation - updated commit subject and message Test CI pipeline: https://gitlab.com/xen-project/people/dimaprkp4k/xen/-/pipelines/1996439444 --- xen/common/efi/boot.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/xen/common/efi/boot.c b/xen/common/efi/boot.c index 50ff1d1bd2..325de05b18 100644 --- a/xen/common/efi/boot.c +++ b/xen/common/efi/boot.c @@ -851,9 +851,13 @@ static bool __init read_file(EFI_FILE_HANDLE dir_handle, CHAR16 *name, PrintErr(what); PrintErr(L" failed for "); 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). + */ } static bool __init read_section(const EFI_LOADED_IMAGE *image, -- 2.43.0