Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

-Wunused-variable in arch/powerpc/platforms/powermac/smp.c #663

Closed
nathanchance opened this issue Sep 20, 2019 · 5 comments
Closed

-Wunused-variable in arch/powerpc/platforms/powermac/smp.c #663

nathanchance opened this issue Sep 20, 2019 · 5 comments
Assignees
Labels
-Wunused-variable [ARCH] powerpc This bug impacts ARCH=powerpc [BUG] linux A bug that should be fixed in the mainline kernel. [FIXED][LINUX] 5.7 This bug was fixed in Linux 5.7

Comments

@nathanchance
Copy link
Member

nathanchance commented Sep 20, 2019

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;
 
@nathanchance nathanchance added good first issue Good for newcomers [BUG] linux A bug that should be fixed in the mainline kernel. [ARCH] powerpc This bug impacts ARCH=powerpc -Wunused-variable labels Sep 20, 2019
@ihalip
Copy link

ihalip commented Sep 20, 2019

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.

@ihalip ihalip self-assigned this Sep 20, 2019
@ihalip
Copy link

ihalip commented Sep 20, 2019

Sent patch. https://lore.kernel.org/lkml/20190920153951.25762-1-ilie.halip@gmail.com/

@ihalip ihalip added the [PATCH] Submitted A patch has been submitted for review label Sep 20, 2019
@nickdesaulniers nickdesaulniers added the low priority This bug is not critical and not a priority label Nov 19, 2019
@nickdesaulniers
Copy link
Member

time to reping that thread

@nickdesaulniers nickdesaulniers added [PATCH] Accepted A submitted patch has been accepted upstream and removed [PATCH] Submitted A patch has been submitted for review labels Mar 17, 2020
@nathanchance
Copy link
Member Author

@nathanchance nathanchance added [FIXED][LINUX] 5.7 This bug was fixed in Linux 5.7 and removed [PATCH] Accepted A submitted patch has been accepted upstream good first issue Good for newcomers low priority This bug is not critical and not a priority labels Apr 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
-Wunused-variable [ARCH] powerpc This bug impacts ARCH=powerpc [BUG] linux A bug that should be fixed in the mainline kernel. [FIXED][LINUX] 5.7 This bug was fixed in Linux 5.7
Projects
None yet
Development

No branches or pull requests

3 participants