[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v4 1/2] arm/acpi: address violations of MISRA C Rule 2.1
- To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
- From: Dmytro Prokopchuk1 <dmytro_prokopchuk1@xxxxxxxx>
- Date: Mon, 29 Sep 2025 18:43:09 +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=jZWjebV7wz+BOSCoJoGNDtDTi2eO9j0uBNtCQOaT6JI=; b=aHDe35JPDw6G13SOA2TSmP2fqJmAevhHRmoqHidMTkNwzgX3iiOMroEKqOud5jz0A7XpoZOcTvy4E+bMY6AWIw8kyL4vBZglPAg5tsk/kj7RzgrrpDQIeMiR6EVAXa+4OQQ5Qsl4nqv8b71pqNZ7pCIdD4crnAhKgPyIg3G0QfalsFmzvRz1jiaNhgekFEMnMR/D4p1k3S5S4LKA8GMWZ6KX4gHboIsCm7oAr8Z2dNv6X5VhLTBesSKmpSnp46cpOCSJjhxw5ucra/NOMKwUjVpRi/i0DgsE3eIqRsJ5zzCOM/CyL02kZm9jqYXg05TlAOMcdaFunlueLctq2z1m8w==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=xmbVklRYnxgqAnZywy8U6vHbD3jB8K0RHa6Bgpr12e/c5DrZy2nTrVkAk/v/Di8X9uha7dksWi0/ReOFRXsdz3BqcPYThWyu3qcKrnuTBm22hKtdo73lihwlYvMsc46WkBiXv+bvIEg+FJ5rDxLL8Kx+rFO4EU5+7Lr1bOIAdueogagPwW+6Q1at7e65XouVarhT+CerukxeQ3jHCEQzbdyfD1rnTbYllmxC9NBGm4ygm2Ay14ZjVqxN6E3W/PkRS4NeaQTJkuBNvA2du8cojDoD0pxlMQ27bEMjC+geyhrqMZruh2SJ9dMxukFYwVZVdiVzt5Rq4XAVsn3oNvAooQ==
- Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=epam.com;
- Cc: Dmytro Prokopchuk1 <dmytro_prokopchuk1@xxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
- Delivery-date: Mon, 29 Sep 2025 18:43:20 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
- Thread-index: AQHcMXDmBSS0MiCg4katDMcviU0Eww==
- Thread-topic: [PATCH v4 1/2] arm/acpi: address violations of MISRA C Rule 2.1
MISRA C Rule 2.1 states: "A project shall not contain unreachable code".
In certain build configuration the following function 'prepare_acpi()' is
defined as inline function and contains the macro 'BUG()'. This resulted
in violation due to the function became non-returning.
To ensure compliance with MISRA C Rule 2.1 remove inline function and its
'BUG()'-based unreachable code. Provide unconditional function declaration
for 'prepare_acpi()'. Rely on the compiler's DCE to remove unused function
calls and use the compile-time constant predicate 'acpi_disabled', defined
as true when 'CONFIG_ACPI' is disabled, to statically resolve conditional
branches:
if ( acpi_disabled )
{
...
}
else
rc = prepare_acpi(d, kinfo);
Signed-off-by: Dmytro Prokopchuk <dmytro_prokopchuk1@xxxxxxxx>
---
xen/arch/arm/include/asm/domain_build.h | 9 ---------
1 file changed, 9 deletions(-)
diff --git a/xen/arch/arm/include/asm/domain_build.h
b/xen/arch/arm/include/asm/domain_build.h
index c6fec3168c..6674dac5e2 100644
--- a/xen/arch/arm/include/asm/domain_build.h
+++ b/xen/arch/arm/include/asm/domain_build.h
@@ -15,16 +15,7 @@ void evtchn_allocate(struct domain *d);
void set_interrupt(gic_interrupt_t interrupt, unsigned int irq,
unsigned int cpumask, unsigned int level);
-#ifndef CONFIG_ACPI
-static inline int prepare_acpi(struct domain *d, struct kernel_info *kinfo)
-{
- /* Only booting with ACPI will hit here */
- BUG();
- return -EINVAL;
-}
-#else
int prepare_acpi(struct domain *d, struct kernel_info *kinfo);
-#endif
int add_ext_regions(unsigned long s_gfn, unsigned long e_gfn, void *data);
--
2.43.0
|