diff --git a/mm/damon/core-test.h b/mm/damon/core-test.h index 24ef1462c604..66c02253b313 100644 --- a/mm/damon/core-test.h +++ b/mm/damon/core-test.h @@ -129,8 +129,19 @@ static void damon_test_split_at(struct kunit *test) struct damon_target *t; struct damon_region *r; + if (!c) + kunit_skip(test, "ctx alloc fail"); t = damon_new_target(); + if (!t) { + damon_destroy_ctx(c); + 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"); + } damon_add_region(r, t); damon_split_region_at(t, r, 25); KUNIT_EXPECT_EQ(test, r->ar.start, 0ul);