Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

SeongJae Park and committed by
Andrew Morton
40b11d1e 7d808bf1

+1 -8
+1 -8
mm/damon/tests/core-kunit.h
··· 144 144 145 145 static void damon_test_split_at(struct kunit *test) 146 146 { 147 - struct damon_ctx *c = damon_new_ctx(); 148 147 struct damon_target *t; 149 148 struct damon_region *r, *r_new; 150 149 151 - if (!c) 152 - kunit_skip(test, "ctx alloc fail"); 153 150 t = damon_new_target(); 154 - if (!t) { 155 - damon_destroy_ctx(c); 151 + if (!t) 156 152 kunit_skip(test, "target alloc fail"); 157 - } 158 153 r = damon_new_region(0, 100); 159 154 if (!r) { 160 - damon_destroy_ctx(c); 161 155 damon_free_target(t); 162 156 kunit_skip(test, "region alloc fail"); 163 157 } ··· 172 178 KUNIT_EXPECT_EQ(test, r->last_nr_accesses, r_new->last_nr_accesses); 173 179 174 180 damon_free_target(t); 175 - damon_destroy_ctx(c); 176 181 } 177 182 178 183 static void damon_test_merge_two(struct kunit *test)