[PATCH] sysctl: Fix one_thousand defined but not used warning

From: Geert Uytterhoeven
Date: Sun Jan 16 2022 - 05:44:41 EST


If CONFIG_PERF_EVENTS is not set:

kernel/sysctl.c:125:12: warning: ‘one_thousand’ defined but not used [-Wunused-variable]
125 | static int one_thousand = 1000;
| ^~~~~~~~~~~~

Fix this by protecting the definition of one_thousand by a check for
CONFIG_PERF_EVENTS, as is used for its single remaining user.

Fixes: 39c65a94cd966153 ("mm/pagealloc: sysctl: change watermark_scale_factor max limit to 30%")
Reported-by: noreply@xxxxxxxxxxxxxx
Signed-off-by: Geert Uytterhoeven <geert@xxxxxxxxxxxxxx>
---
kernel/sysctl.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index ef77be575d8754d2..d77208f9a56f2907 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -122,12 +122,12 @@ static unsigned long one_ul = 1;
static unsigned long long_max = LONG_MAX;
static int one_hundred = 100;
static int two_hundred = 200;
-static int one_thousand = 1000;
static int three_thousand = 3000;
#ifdef CONFIG_PRINTK
static int ten_thousand = 10000;
#endif
#ifdef CONFIG_PERF_EVENTS
+static int one_thousand = 1000;
static int six_hundred_forty_kb = 640 * 1024;
#endif

--
2.25.1