aboutsummaryrefslogtreecommitdiffstats
path: root/lib/kunit/test-test.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/kunit/test-test.c')
-rw-r--r--lib/kunit/test-test.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/lib/kunit/test-test.c b/lib/kunit/test-test.c
index 06d34d36b103..e0ab4bd546ea 100644
--- a/lib/kunit/test-test.c
+++ b/lib/kunit/test-test.c
@@ -78,16 +78,13 @@ static int kunit_try_catch_test_init(struct kunit *test)
struct kunit_try_catch_test_context *ctx;
ctx = kunit_kzalloc(test, sizeof(*ctx), GFP_KERNEL);
- if (!ctx)
- return -ENOMEM;
-
+ KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ctx);
test->priv = ctx;
ctx->try_catch = kunit_kmalloc(test,
sizeof(*ctx->try_catch),
GFP_KERNEL);
- if (!ctx->try_catch)
- return -ENOMEM;
+ KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ctx->try_catch);
return 0;
}