[PATCH 1/7] powerpc/sysfs: Fix W=1 compile warning

Christophe Leroy christophe.leroy at csgroup.eu
Fri Sep 11 15:26:43 AEST 2020



Le 10/09/2020 à 23:02, Cédric Le Goater a écrit :
> arch/powerpc/kernel/sysfs.c: In function ‘sysfs_create_dscr_default’:
> arch/powerpc/kernel/sysfs.c:228:7: error: variable ‘err’ set but not used [-Werror=unused-but-set-variable]
>     int err = 0;
>         ^~~
> cc1: all warnings being treated as errors

A small sentence explaining how this is fixes would be welcome, so that 
you don't need to read the code the know what the commit does to fix the 
warning. Even the subject should be more explicite, rather than saying 
"Fix W=1 compile warning", I think it should say something like "remove 
unused err variable"


> 
> Cc: Madhavan Srinivasan <maddy at linux.ibm.com>
> Signed-off-by: Cédric Le Goater <clg at kaod.org>

Reviewed-by: Christophe Leroy <christophe.leroy at c-s.fr>

> ---
>   arch/powerpc/kernel/sysfs.c | 3 +--
>   1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/arch/powerpc/kernel/sysfs.c b/arch/powerpc/kernel/sysfs.c
> index 46b4ebc33db7..821a3dc4c924 100644
> --- a/arch/powerpc/kernel/sysfs.c
> +++ b/arch/powerpc/kernel/sysfs.c
> @@ -225,14 +225,13 @@ static DEVICE_ATTR(dscr_default, 0600,
>   static void sysfs_create_dscr_default(void)
>   {
>   	if (cpu_has_feature(CPU_FTR_DSCR)) {
> -		int err = 0;
>   		int cpu;
>   
>   		dscr_default = spr_default_dscr;
>   		for_each_possible_cpu(cpu)
>   			paca_ptrs[cpu]->dscr_default = dscr_default;
>   
> -		err = device_create_file(cpu_subsys.dev_root, &dev_attr_dscr_default);
> +		device_create_file(cpu_subsys.dev_root, &dev_attr_dscr_default);
>   	}
>   }
>   #endif /* CONFIG_PPC64 */
> 


More information about the Linuxppc-dev mailing list