Skip to contentSkip to conversation

scftorture: Make symbol 'scf_torture_rand' static

PATCH In review Wei Yongjun 2 participants 2 messages Jul 2, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 scftorture: Make symbol 'scf_torture_rand' static

Fix sparse build warning:

kernel/scftorture.c:124:1: warning:
symbol '__pcpu_scope_scf_torture_rand' was not declared. Should it be static?

---
 kernel/scftorture.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/scftorture.c +1 -1
index 52750c564404..d63d700ad297 100644
@@ -121,7 +121,7 @@ static unsigned long scf_sel_totweight;
 static atomic_t n_started;
 static atomic_t n_errs;
 
-DEFINE_TORTURE_RANDOM_PERCPU(scf_torture_rand);
+static DEFINE_TORTURE_RANDOM_PERCPU(scf_torture_rand);
 
 // Print torture statistics.  Caller must ensure serialization.
 static void scf_torture_stats_print(void)
#1 lore raw
Quoted 7 lines · Wei Yongjun

Fix sparse build warning:

kernel/scftorture.c:124:1: warning:
symbol '__pcpu_scope_scf_torture_rand' was not declared. Should it be static?

Good catch, applied, thank you!

Due to recent changes, I hand-applied this as shown below. Please let me know if I messed anything up.

Thanx, Paul

------------------------------------------------------------------------

commit ff9210137b0b8d8f045dd1fd116253ba7686e892

Author: Wei Yongjun <[email protected]>
Date:   Thu Jul 2 09:56:50 2020 -0700

scftorture: Make symbol 'scf_torture_rand' static

The sparse tool complains as follows

kernel/scftorture.c:124:1: warning:
symbol '__pcpu_scope_scf_torture_rand' was not declared. Should it be static?

And this per-CPU variable is not used outside of scftorture.c, so this commit marks it static.

kernel/scftorture.c +1 -1
index 52f74f1..a7fea76 100644
@@ -134,7 +134,7 @@ static atomic_t n_alloc_errs;
 static bool scfdone;
 static char *bangstr = "";
 
-DEFINE_TORTURE_RANDOM_PERCPU(scf_torture_rand);
+static DEFINE_TORTURE_RANDOM_PERCPU(scf_torture_rand);
 
 // Print torture statistics.  Caller must ensure serialization.
 static void scf_torture_stats_print(void)