aboutsummaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
Diffstat (limited to 'mm')
-rw-r--r--mm/damon/tests/core-kunit.h29
1 files changed, 13 insertions, 16 deletions
diff --git a/mm/damon/tests/core-kunit.h b/mm/damon/tests/core-kunit.h
index 96a4cd489b393d..ae97886137dc5e 100644
--- a/mm/damon/tests/core-kunit.h
+++ b/mm/damon/tests/core-kunit.h
@@ -499,23 +499,20 @@ static void damos_test_new_filter(struct kunit *test)
static void damos_test_commit_filter(struct kunit *test)
{
- struct damos_filter *src_filter, *dst_filter;
-
- src_filter = damos_new_filter(DAMOS_FILTER_TYPE_ANON, true, true);
- if (!src_filter)
- kunit_skip(test, "src filter alloc fail");
- dst_filter = damos_new_filter(DAMOS_FILTER_TYPE_ACTIVE, false, false);
- if (!dst_filter) {
- damos_destroy_filter(src_filter);
- kunit_skip(test, "dst filter alloc fail");
- }
- damos_commit_filter(dst_filter, src_filter);
- KUNIT_EXPECT_EQ(test, dst_filter->type, src_filter->type);
- KUNIT_EXPECT_EQ(test, dst_filter->matching, src_filter->matching);
- KUNIT_EXPECT_EQ(test, dst_filter->allow, src_filter->allow);
+ struct damos_filter src_filter = {
+ .type = DAMOS_FILTER_TYPE_ANON,
+ .matching = true,
+ .allow = true};
+ struct damos_filter dst_filter = {
+ .type = DAMOS_FILTER_TYPE_ACTIVE,
+ .matching = false,
+ .allow = false,
+ };
- damos_destroy_filter(src_filter);
- damos_destroy_filter(dst_filter);
+ damos_commit_filter(&dst_filter, &src_filter);
+ KUNIT_EXPECT_EQ(test, dst_filter.type, src_filter.type);
+ KUNIT_EXPECT_EQ(test, dst_filter.matching, src_filter.matching);
+ KUNIT_EXPECT_EQ(test, dst_filter.allow, src_filter.allow);
}
static void damos_test_filter_out(struct kunit *test)