mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-04-09 10:00:55 -04:00
drm/vc4: tests: Use return instead of assert
The vc4_mock_atomic_add_output() and vc4_mock_atomic_del_output() assert that the functions they are calling didn't fail. Since some of them can return EDEADLK, we can't properly deal with it. Since both functions are expected to return an int, and all caller check the return value, let's just properly propagate the errors when they occur. Fixes:f759f5b53f("drm/vc4: tests: Introduce a mocking infrastructure") Fixes:76ec18dc5a("drm/vc4: tests: Add unit test suite for the PV muxing") Reviewed-by: Maíra Canal <mcanal@igalia.com> Link: https://lore.kernel.org/r/20250403-drm-vc4-kunit-failures-v2-1-e09195cc8840@kernel.org Signed-off-by: Maxime Ripard <mripard@kernel.org>
This commit is contained in:
@@ -75,24 +75,30 @@ int vc4_mock_atomic_add_output(struct kunit *test,
|
||||
int ret;
|
||||
|
||||
encoder = vc4_find_encoder_by_type(drm, type);
|
||||
KUNIT_ASSERT_NOT_ERR_OR_NULL(test, encoder);
|
||||
if (!encoder)
|
||||
return -ENODEV;
|
||||
|
||||
crtc = vc4_find_crtc_for_encoder(test, drm, encoder);
|
||||
KUNIT_ASSERT_NOT_ERR_OR_NULL(test, crtc);
|
||||
if (!crtc)
|
||||
return -ENODEV;
|
||||
|
||||
output = encoder_to_vc4_dummy_output(encoder);
|
||||
conn = &output->connector;
|
||||
conn_state = drm_atomic_get_connector_state(state, conn);
|
||||
KUNIT_ASSERT_NOT_ERR_OR_NULL(test, conn_state);
|
||||
if (IS_ERR(conn_state))
|
||||
return PTR_ERR(conn_state);
|
||||
|
||||
ret = drm_atomic_set_crtc_for_connector(conn_state, crtc);
|
||||
KUNIT_EXPECT_EQ(test, ret, 0);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
crtc_state = drm_atomic_get_crtc_state(state, crtc);
|
||||
KUNIT_ASSERT_NOT_ERR_OR_NULL(test, crtc_state);
|
||||
if (IS_ERR(crtc_state))
|
||||
return PTR_ERR(crtc_state);
|
||||
|
||||
ret = drm_atomic_set_mode_for_crtc(crtc_state, &default_mode);
|
||||
KUNIT_EXPECT_EQ(test, ret, 0);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
crtc_state->active = true;
|
||||
|
||||
@@ -113,26 +119,32 @@ int vc4_mock_atomic_del_output(struct kunit *test,
|
||||
int ret;
|
||||
|
||||
encoder = vc4_find_encoder_by_type(drm, type);
|
||||
KUNIT_ASSERT_NOT_ERR_OR_NULL(test, encoder);
|
||||
if (!encoder)
|
||||
return -ENODEV;
|
||||
|
||||
crtc = vc4_find_crtc_for_encoder(test, drm, encoder);
|
||||
KUNIT_ASSERT_NOT_ERR_OR_NULL(test, crtc);
|
||||
if (!crtc)
|
||||
return -ENODEV;
|
||||
|
||||
crtc_state = drm_atomic_get_crtc_state(state, crtc);
|
||||
KUNIT_ASSERT_NOT_ERR_OR_NULL(test, crtc_state);
|
||||
if (IS_ERR(crtc_state))
|
||||
return PTR_ERR(crtc_state);
|
||||
|
||||
crtc_state->active = false;
|
||||
|
||||
ret = drm_atomic_set_mode_for_crtc(crtc_state, NULL);
|
||||
KUNIT_ASSERT_EQ(test, ret, 0);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
output = encoder_to_vc4_dummy_output(encoder);
|
||||
conn = &output->connector;
|
||||
conn_state = drm_atomic_get_connector_state(state, conn);
|
||||
KUNIT_ASSERT_NOT_ERR_OR_NULL(test, conn_state);
|
||||
if (IS_ERR(conn_state))
|
||||
return PTR_ERR(conn_state);
|
||||
|
||||
ret = drm_atomic_set_crtc_for_connector(conn_state, NULL);
|
||||
KUNIT_ASSERT_EQ(test, ret, 0);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user