[PATCH] mm/damon: remove dead code in damon_lru_sort_enabled_store()
From: Zeng Jingxiang
Date: Thu Aug 11 2022 - 21:27:22 EST
From: Zeng Jingxiang <linuszeng@xxxxxxxxxxx>
The variable damon_lru_sort_initialized is always true, causing the
corresponding conditional expression cannot be executed.
Assigning true to damon_lru_sort_initialized here
544 damon_lru_sort_initialized = true;
The value of damon_lru_sort_initialized is always true.
As a result, the following expression cannot be executed.
463 if (!damon_lru_sort_initialized)
464 return rc;
Fixes: 40e983cca927 ("mm/damon: introduce DAMON-based LRU-lists Sorting")
Signed-off-by: Zeng Jingxiang <linuszeng@xxxxxxxxxxx>
---
mm/damon/lru_sort.c | 6 ------
1 file changed, 6 deletions(-)
diff --git a/mm/damon/lru_sort.c b/mm/damon/lru_sort.c
index 9de6f00a71c5..e2a656e1b728 100644
--- a/mm/damon/lru_sort.c
+++ b/mm/damon/lru_sort.c
@@ -450,8 +450,6 @@ static void damon_lru_sort_timer_fn(struct work_struct *work)
}
static DECLARE_DELAYED_WORK(damon_lru_sort_timer, damon_lru_sort_timer_fn);
-static bool damon_lru_sort_initialized;
-
static int damon_lru_sort_enabled_store(const char *val,
const struct kernel_param *kp)
{
@@ -460,9 +458,6 @@ static int damon_lru_sort_enabled_store(const char *val,
if (rc < 0)
return rc;
- if (!damon_lru_sort_initialized)
- return rc;
-
schedule_delayed_work(&damon_lru_sort_timer, 0);
return 0;
@@ -541,7 +536,6 @@ static int __init damon_lru_sort_init(void)
schedule_delayed_work(&damon_lru_sort_timer, 0);
- damon_lru_sort_initialized = true;
return 0;
}
--
2.36.1