[PATCH] ARM: arch/arm/kernel/signal.c: resolve set-but-not-used warning

Baruch Siach baruch at tkos.co.il
Sun Jun 7 22:36:30 PDT 2026


Hi Ethan,

On Sun, Jun 07 2026, Ethan Nelson-Moore wrote:

> If neither CONFIG_IWMMXT nor CONFIG_VFP are enabled (which is the case,
> for example, in rpc_defconfig), the variable "aux" is set but not used,
> which generates a warning during W=1 builds. Resolve this issue by only
> defining the variable if it will be used.
>
> Signed-off-by: Ethan Nelson-Moore <enelsonmoore at gmail.com>
> ---
>  arch/arm/kernel/signal.c | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/arch/arm/kernel/signal.c b/arch/arm/kernel/signal.c
> index 7be9188d83d9..1d015b696a76 100644
> --- a/arch/arm/kernel/signal.c
> +++ b/arch/arm/kernel/signal.c
> @@ -140,7 +140,9 @@ static int restore_vfp_context(char __user **auxp)
>  static int restore_sigframe(struct pt_regs *regs, struct sigframe __user *sf)
>  {
>  	struct sigcontext context;
> +#if defined(CONFIG_IWMMXT) || defined(CONFIG_VFP)
>  	char __user *aux;

__maybe_unused is a common attribute marking local variables that are not
always used. I find it nicer than another layer of #ifdef.

baruch

> +#endif
>  	sigset_t set;
>  	int err;
>  
> @@ -171,6 +173,7 @@ static int restore_sigframe(struct pt_regs *regs, struct sigframe __user *sf)
>  
>  	err |= !valid_user_regs(regs);
>  
> +#if defined(CONFIG_IWMMXT) || defined(CONFIG_VFP)
>  	aux = (char __user *) sf->uc.uc_regspace;
>  #ifdef CONFIG_IWMMXT
>  	if (err == 0)
> @@ -180,6 +183,7 @@ static int restore_sigframe(struct pt_regs *regs, struct sigframe __user *sf)
>  	if (err == 0)
>  		err |= restore_vfp_context(&aux);
>  #endif
> +#endif /* defined(CONFIG_IWMMXT) || defined(CONFIG_VFP) */
>  
>  	return err;
>  }

-- 
                                                     ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch at tkos.co.il - tel: +972.52.368.4656, http://www.tkos.co.il -



More information about the linux-arm-kernel mailing list