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@epam.com>
Reviewed-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
This commit is contained in:
Dmytro Prokopchuk authored and Jan Beulich committed 2025-08-25 12:52:03 +02:00
1 parent e28d97d598
commit 9e5a9b53f6
1 file changed
-1
-1
View File
@@ -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,
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.