aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSeongJae Park <sj@kernel.org>2025-11-01 11:20:15 -0700
committerAndrew Morton <akpm@linux-foundation.org>2025-11-16 17:28:35 -0800
commit40b11d1eb19cf5c53a642d35f27fd1eafd9e0caf (patch)
tree833a19f534f862e7e1641148e5c7cdf28a8ea0a3
parent7d808bf13943f4c6a6142400bffe14267f6dc997 (diff)
mm/damon/tests/core-kunit: remove unnecessary damon_ctx variable on damon_test_split_at()
damon_test_split_at() dynamically allocates a 'struct damon_ctx' object, but it is not really being used in the code other than handling the allocation failure and deallocating it at the end of the function. Remove the unnecessary allocation and deallocation of the object. Link: https://lkml.kernel.org/r/20251101182021.74868-22-sj@kernel.org Signed-off-by: SeongJae Park <sj@kernel.org> Cc: Brendan Higgins <brendan.higgins@linux.dev> Cc: David Gow <davidgow@google.com> Cc: Kefeng Wang <wangkefeng.wang@huawei.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
-rw-r--r--mm/damon/tests/core-kunit.h9
1 files changed, 1 insertions, 8 deletions
diff --git a/mm/damon/tests/core-kunit.h b/mm/damon/tests/core-kunit.h
index a91d798caa70..726f593930e7 100644
--- a/mm/damon/tests/core-kunit.h
+++ b/mm/damon/tests/core-kunit.h
@@ -144,20 +144,14 @@ static void damon_test_aggregate(struct kunit *test)
static void damon_test_split_at(struct kunit *test)
{
- struct damon_ctx *c = damon_new_ctx();
struct damon_target *t;
struct damon_region *r, *r_new;
- if (!c)
- kunit_skip(test, "ctx alloc fail");
t = damon_new_target();
- if (!t) {
- damon_destroy_ctx(c);
+ if (!t)
kunit_skip(test, "target alloc fail");
- }
r = damon_new_region(0, 100);
if (!r) {
- damon_destroy_ctx(c);
damon_free_target(t);
kunit_skip(test, "region alloc fail");
}
@@ -178,7 +172,6 @@ static void damon_test_split_at(struct kunit *test)
KUNIT_EXPECT_EQ(test, r->last_nr_accesses, r_new->last_nr_accesses);
damon_free_target(t);
- damon_destroy_ctx(c);
}
static void damon_test_merge_two(struct kunit *test)