[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v4] common/efi: fix Rule 2.1 violation in read_file()
- To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
- From: Dmytro Prokopchuk1 <dmytro_prokopchuk1@xxxxxxxx>
- Date: Sun, 24 Aug 2025 15:10:47 +0000
- Accept-language: en-US, uk-UA, ru-RU
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=epam.com; dmarc=pass action=none header.from=epam.com; dkim=pass header.d=epam.com; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=LI0sw4VQoV6ivAmxst3keUXn201q9YNHqSmgOpeMvFM=; b=kRs8x04ktGA/59AYs26UP2hN5Rj06v0z+d8QdW0f9OQA6TTH+ljbFHET3w3Rw27Y2BhWxCWMMlNl6cofMFGe5KBCIMpzFRHSZRwYr4hOfBINzO0NvEUWS72gRXGN2vpaUfvxCPgZS867Lh8+W4OQxc/7cF3U8o+dheeokPAAWQGMTHswVawxYjrJspYFZ/B+cWhxU5hby1373MCAwr5Z4+AlXE8K1tlYZEI+uTPDHk9qEIQasuQTn0yf9bXspx5+eyY65X6YJvqXEqYdOEfhpWcbg3XyQWs2INDuetvhlWQ/rQio1daQj9CGRyA2N+a+CrITfwzBmCscbYISXrVU2Q==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=vZrAtPdFH7eaJLOq02+gRx7xkcaJEonLzyLMkO2lgHJHr3nng1v4wr4BIInLC+md0+v2Tn6UWG55DVbLMr6qcOzpV6TFJ+MyqHiWK3zpylXXbLG+9a5tNAR9HBL+FS8V830MoV1MpKKwlRqWe/WU3KVhZm22djq+UZr+eAlaUG3xxAMSamrkY2AuoHRsksU2PA/1rQiN61/K/jPV/5qI8ObDJZlhks2jYrgPA19KLXIPsvZ309dekfqzYJW3nQKq9CLeWxEVUWkqi75BP+Gblcw4kyrm3bwN94JxVRct4eCtyHQ4odGta8cDcJk53hGWeUjoWq/kMJyd0dtmZhib4g==
- Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=epam.com;
- Cc: Dmytro Prokopchuk1 <dmytro_prokopchuk1@xxxxxxxx>, "Daniel P. Smith" <dpsmith@xxxxxxxxxxxxxxxxxxxx>, Marek Marczykowski-Górecki <marmarek@xxxxxxxxxxxxxxxxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>
- Delivery-date: Sun, 24 Aug 2025 15:11:02 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
- Thread-index: AQHcFQlF20ah2tP5uUOdXQ1Ea/l40w==
- Thread-topic: [PATCH v4] common/efi: fix Rule 2.1 violation in read_file()
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_prokopchuk1@xxxxxxxx>
Reviewed-by: Marek Marczykowski-Górecki <marmarek@xxxxxxxxxxxxxxxxxxxxxx>
---
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._5Fprokopchuk1@xxxxxxxx/
---
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
|