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 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_prokopch...@epam.com> Reviewed-by: Marek Marczykowski-Górecki <marma...@invisiblethingslab.com> --- Changes in v4: - verbose code comment was moved into commit message - kept the old comment that was already there in read_file() - added Marek's tag Link to v3: https://patchew.org/Xen/4a1a4a3406d227348afa1ad2ce90dc5264fdb44a.1755783750.git.dmytro._5fprokopch...@epam.com/ --- 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, -- 2.43.0