[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH v2 2/3] xen/arm: add missing noreturn attributes


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: <victorm.lira@xxxxxxx>
  • Date: Fri, 6 Jun 2025 14:27:08 -0700
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0)
  • 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=r93UQ2OGt46J18SmdFjIeojQ9Xy2SF7hXLY3jAZxNDo=; b=HPTdA9h3KZiycoPSvauL2NzAp7WnWjQFl19iMvkLOT8OAgWW5DUuTxOsa+SX7/HQG7Xrxtk1giDWpKbWXwmW7e1CZfrmXFFsN5f8VtSjuCEad7fG61QPkET+P6pWJxk7mG0raiHsThlNV+VPnyv7b0ygxp/ZVwbULPzqZLneIMMq12SItBXzfYlufzG5IvYSjkpV1F1FSp4+8qGNSZ+jPTUsTXw1/5jiiQATNYl4Arv3v0FaPhPb9ybveJKYKgXy5VrbhGRAoePlTF2io/pLU2deLthXah6MaQBLqD952OggkewxiI8C4mvZgVYe1mLvSJFs8NVml2z57W7ZQOt4sw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=p27fMDvd4gVQqfJBOEYh68yVDFJlGUhI6KPsrTKUeM+mre4TjBzghDOgxGyRpp3E/kxpXJ6Eda30zjWadmp01sMOVnarW9QT1qVRGvau99znBXQUsHiH837mgQAdk6jx9qvOKfc2a3tCGG81/KiYIVRuzV/vyYcAFQLejF97Sh4xq07+1I7cZObb/Rzjp/FsC/numrUWZk8SA33f3h1fCTr88ImR4Z2s1a/XMD3G4HOeBVAX1XJz/OzYl5NUjMh8gbCvcKAcm17n8FiOfTxXE7ifnI7b4C15GfApn9Pv9tR7P4uiMLP+JEiljvTfHN+jtwBFKnPg/kAYFzL/DGWOLw==
  • Cc: Nicola Vetrini <nicola.vetrini@xxxxxxxxxxx>, Victor Lira <victorm.lira@xxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, "Anthony PERARD" <anthony.perard@xxxxxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, "Jan Beulich" <jbeulich@xxxxxxxx>, Julien Grall <julien@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, "Stefano Stabellini" <sstabellini@xxxxxxxxxx>, Federico Serafini <federico.serafini@xxxxxxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>
  • Delivery-date: Fri, 06 Jun 2025 21:27:41 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

From: Nicola Vetrini <nicola.vetrini@xxxxxxxxxxx>

The marked functions never return to their caller, but lack the
`noreturn' attribute.

Functions that never return should be declared with a `noreturn'
attribute.

The lack of `noreturn' causes a violation of MISRA C Rule 17.11 (not
currently accepted in Xen), and also Rule 2.1: "A project shall not
contain unreachable code". Depending on the compiler used and the
compiler optimization used, the lack of `noreturn' might lead to the
presence of unreachable code.

No functional change.

Signed-off-by: Nicola Vetrini <nicola.vetrini@xxxxxxxxxxx>
Signed-off-by: Victor Lira <victorm.lira@xxxxxxx>
---
Changes in v2:
- improved commit message
---
Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
Cc: Anthony PERARD <anthony.perard@xxxxxxxxxx>
Cc: Michal Orzel <michal.orzel@xxxxxxx>
Cc: Jan Beulich <jbeulich@xxxxxxxx>
Cc: Julien Grall <julien@xxxxxxx>
Cc: Roger Pau Monné <roger.pau@xxxxxxxxxx>
Cc: Stefano Stabellini <sstabellini@xxxxxxxxxx>
Cc: Nicola Vetrini <nicola.vetrini@xxxxxxxxxxx>
Cc: Federico Serafini <federico.serafini@xxxxxxxxxxx>
Cc: Bertrand Marquis <bertrand.marquis@xxxxxxx>
---
 xen/arch/arm/efi/efi-boot.h            | 2 +-
 xen/arch/arm/include/asm/arm64/traps.h | 2 +-
 xen/arch/arm/include/asm/processor.h   | 2 +-
 xen/arch/arm/setup.c                   | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/xen/arch/arm/efi/efi-boot.h b/xen/arch/arm/efi/efi-boot.h
index d2a09ad3a1..ee80560e13 100644
--- a/xen/arch/arm/efi/efi-boot.h
+++ b/xen/arch/arm/efi/efi-boot.h
@@ -934,7 +934,7 @@ static void __init efi_arch_blexit(void)
         efi_bs->FreePool(memmap);
 }

-static void __init efi_arch_halt(void)
+static void noreturn __init efi_arch_halt(void)
 {
     stop_cpu();
 }
diff --git a/xen/arch/arm/include/asm/arm64/traps.h 
b/xen/arch/arm/include/asm/arm64/traps.h
index 3be2fa69ee..b7435c6e73 100644
--- a/xen/arch/arm/include/asm/arm64/traps.h
+++ b/xen/arch/arm/include/asm/arm64/traps.h
@@ -6,7 +6,7 @@ void inject_undef64_exception(struct cpu_user_regs *regs);
 void do_sysreg(struct cpu_user_regs *regs,
                const union hsr hsr);

-void do_bad_mode(struct cpu_user_regs *regs, int reason);
+void noreturn do_bad_mode(struct cpu_user_regs *regs, int reason);

 #endif /* __ASM_ARM64_TRAPS__ */
 /*
diff --git a/xen/arch/arm/include/asm/processor.h 
b/xen/arch/arm/include/asm/processor.h
index 9cbc4f9110..92c8bc1a31 100644
--- a/xen/arch/arm/include/asm/processor.h
+++ b/xen/arch/arm/include/asm/processor.h
@@ -571,7 +571,7 @@ extern register_t __cpu_logical_map[];
 #endif

 #ifndef __ASSEMBLY__
-void panic_PAR(uint64_t par);
+void noreturn panic_PAR(uint64_t par);

 /* Debugging functions are declared with external linkage to aid development. 
*/
 void show_registers(const struct cpu_user_regs *regs);
diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c
index 734e23da44..ed72317af3 100644
--- a/xen/arch/arm/setup.c
+++ b/xen/arch/arm/setup.c
@@ -63,7 +63,7 @@ bool __read_mostly acpi_disabled;

 domid_t __read_mostly max_init_domid;

-static __used void init_done(void)
+static __used void noreturn init_done(void)
 {
     int rc;

--
2.25.1



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.