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

Re: [PATCH] xen: add missing noreturn attribute



On Thu, 24 Jul 2025, Dmytro Prokopchuk1 wrote:
> These functions never return to their caller,
> causing a violation of MISRA C Rule 2.1:
> "A project shall not contain unreachable code".
> Add the `noreturn' attribute to fix this.
> 
> No functional changes.
> 
> Signed-off-by: Dmytro Prokopchuk <dmytro_prokopchuk1@xxxxxxxx>

Reviewed-by: Stefano Stabellini <sstabellini@xxxxxxxxxx>


> ---
>  xen/arch/arm/domain.c  | 2 +-
>  xen/arch/arm/setup.c   | 2 +-
>  xen/arch/arm/smpboot.c | 2 +-
>  xen/common/efi/boot.c  | 2 +-
>  4 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/xen/arch/arm/domain.c b/xen/arch/arm/domain.c
> index 79a144e61b..310c578909 100644
> --- a/xen/arch/arm/domain.c
> +++ b/xen/arch/arm/domain.c
> @@ -298,7 +298,7 @@ static void schedule_tail(struct vcpu *prev)
>  extern void noreturn return_to_new_vcpu32(void);
>  extern void noreturn return_to_new_vcpu64(void);
>  
> -static void continue_new_vcpu(struct vcpu *prev)
> +static void noreturn continue_new_vcpu(struct vcpu *prev)
>  {
>      current->arch.actlr = READ_SYSREG(ACTLR_EL1);
>      processor_vcpu_initialise(current);
> diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c
> index 27bd3f5a6e..bb35afe56c 100644
> --- a/xen/arch/arm/setup.c
> +++ b/xen/arch/arm/setup.c
> @@ -306,7 +306,7 @@ void __init init_pdx(void)
>  size_t __read_mostly dcache_line_bytes;
>  
>  /* C entry point for boot CPU */
> -void asmlinkage __init start_xen(unsigned long fdt_paddr)
> +void asmlinkage __init noreturn start_xen(unsigned long fdt_paddr)
>  {
>      size_t fdt_size;
>      const char *cmdline;
> diff --git a/xen/arch/arm/smpboot.c b/xen/arch/arm/smpboot.c
> index 73de7503e9..7f3cfa812e 100644
> --- a/xen/arch/arm/smpboot.c
> +++ b/xen/arch/arm/smpboot.c
> @@ -315,7 +315,7 @@ smp_prepare_cpus(void)
>  }
>  
>  /* Boot the current CPU */
> -void asmlinkage start_secondary(void)
> +void asmlinkage noreturn start_secondary(void)
>  {
>      unsigned int cpuid = init_data.cpuid;
>  
> diff --git a/xen/common/efi/boot.c b/xen/common/efi/boot.c
> index df29444220..4b60bd719e 100644
> --- a/xen/common/efi/boot.c
> +++ b/xen/common/efi/boot.c
> @@ -285,7 +285,7 @@ static bool __init match_guid(const EFI_GUID *guid1, 
> const EFI_GUID *guid2)
>  }
>  
>  /* generic routine for printing error messages */
> -static void __init PrintErrMesg(const CHAR16 *mesg, EFI_STATUS ErrCode)
> +static void __init noreturn PrintErrMesg(const CHAR16 *mesg, EFI_STATUS 
> ErrCode)
>  {
>      StdOut = StdErr;
>      PrintErr(mesg);
> -- 
> 2.43.0
> 



 


Rackspace

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