Linux: -Wunused-variable in arch/powerpc/platforms/powermac/smp.c

Created on 20 Sep 2019  路  5Comments  路  Source: ClangBuiltLinux/linux

When building ppc64_defconfig:

arch/powerpc/platforms/powermac/smp.c:664:26: warning: unused variable 'core99_l2_cache' [-Wunused-variable]
volatile static long int core99_l2_cache;
                         ^
arch/powerpc/platforms/powermac/smp.c:665:26: warning: unused variable 'core99_l3_cache' [-Wunused-variable]
volatile static long int core99_l3_cache;
                         ^
2 warnings generated.

Unless I am missing something, I think this is the fix...

diff --git a/arch/powerpc/platforms/powermac/smp.c b/arch/powerpc/platforms/powermac/smp.c
index f95fbdee6efe..33ae1b736255 100644
--- a/arch/powerpc/platforms/powermac/smp.c
+++ b/arch/powerpc/platforms/powermac/smp.c
@@ -661,12 +661,12 @@ static void smp_core99_gpio_tb_freeze(int freeze)
 #endif /* !CONFIG_PPC64 */

 /* L2 and L3 cache settings to pass from CPU0 to CPU1 on G4 cpus */
-volatile static long int core99_l2_cache;
-volatile static long int core99_l3_cache;
-
 static void core99_init_caches(int cpu)
 {
 #ifndef CONFIG_PPC64
+       volatile long int core99_l2_cache;
+       volatile long int core99_l3_cache;
+
        if (!cpu_has_feature(CPU_FTR_L2CR))
                return;


-Wunused-variable [ARCH] powerpc [BUG] linux [FIXED][LINUX] 5.7

Most helpful comment

All 5 comments

I think these need to be preserved across function calls, thus cannot be local. At a glance, this should happen:

core99_init_caches(0); // sets the variables from cpu 0
core99_init_caches(N); // uses the variables for cpu N

This is obvious from the implementations of smp_core99_probe and smp_core99_setup_cpu in that same file.

time to reping that thread

Was this page helpful?
0 / 5 - 0 ratings