From a3e8dc37a616db6fddbae80a83f95a3ac9a949a7 Mon Sep 17 00:00:00 2001 From: Alex Hung Date: Thu, 10 Sep 2026 14:06:40 -0600 Subject: [PATCH] drm/amd/display: Fix KUnit checkpatch warnings [WHY] Clean up the AMDGPU DM KUnit tests after checkpatch reported an invalid sizeof(void) allocation, typed kzalloc patterns, and a repeated word in a kernel-doc summary. Clarify the test name that covers an active CRTC state transition. [HOW] - Use sizeof(cpu_ptr) for the fake CPU pointer allocation. - Replace typed kzalloc(sizeof(*object), ...) calls with kzalloc_obj(*object, ...) in the connector, IRQ, plane, and atomic-state tests. - Rename the CRTC active-state test and update its kernel-doc and suite registration. Assisted-by: Copilot:GPT-5.6-Luna Reviewed-by: Jerry Zuo Signed-off-by: Alex Hung Signed-off-by: George Zhang Tested-by: Dan Wheeler Signed-off-by: Alex Deucher --- .../drm/amd/display/amdgpu_dm/tests/amdgpu_dm_crtc_test.c | 6 +++--- .../drm/amd/display/amdgpu_dm/tests/amdgpu_dm_plane_test.c | 2 +- .../amd/display/amdgpu_dm/tests/amdgpu_dm_services_test.c | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_crtc_test.c b/drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_crtc_test.c index e4396ad8934e..489dd56474b9 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_crtc_test.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_crtc_test.c @@ -42,10 +42,10 @@ static void dm_test_crtc_modeset_required_active_mode_changed(struct kunit *test } /** - * dm_test_crtc_modeset_required_active_active_changed - Test Crtc modeset required active active changed + * dm_test_crtc_modeset_required_active_state_changed - Test modeset required when the active state changes * @test: The KUnit test context */ -static void dm_test_crtc_modeset_required_active_active_changed(struct kunit *test) +static void dm_test_crtc_modeset_required_active_state_changed(struct kunit *test) { struct drm_crtc_state state = {}; @@ -2621,7 +2621,7 @@ static void dm_test_crtc_atomic_check_invalid_stream_fails(struct kunit *test) static struct kunit_case amdgpu_dm_crtc_tests[] = { /* amdgpu_dm_crtc_modeset_required */ KUNIT_CASE(dm_test_crtc_modeset_required_active_mode_changed), - KUNIT_CASE(dm_test_crtc_modeset_required_active_active_changed), + KUNIT_CASE(dm_test_crtc_modeset_required_active_state_changed), KUNIT_CASE(dm_test_crtc_modeset_required_active_connectors_changed), KUNIT_CASE(dm_test_crtc_modeset_required_inactive), KUNIT_CASE(dm_test_crtc_modeset_required_no_changes), diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_plane_test.c b/drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_plane_test.c index 776272cd93ae..7422e8ba9564 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_plane_test.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_plane_test.c @@ -2448,7 +2448,7 @@ static void dm_test_plane_destroy_state_releases_resources(struct kunit *test) KUNIT_ASSERT_NOT_NULL(test, dc_plane_state); /* destroy_state frees the state itself, so use a plain allocation. */ - dm_plane_state = kzalloc(sizeof(*dm_plane_state), GFP_KERNEL); + dm_plane_state = kzalloc_obj(*dm_plane_state, GFP_KERNEL); KUNIT_ASSERT_NOT_NULL(test, dm_plane_state); /* Hold an extra reference so the release does not free KUnit memory. */ diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_services_test.c b/drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_services_test.c index 4ff430e4b23b..bdbceb83a8a8 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_services_test.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_services_test.c @@ -337,7 +337,7 @@ static int dm_test_gpu_mem_init(struct kunit *test) { void *cpu_ptr; - cpu_ptr = kunit_kzalloc(test, sizeof(*cpu_ptr), GFP_KERNEL); + cpu_ptr = kunit_kzalloc(test, sizeof(cpu_ptr), GFP_KERNEL); KUNIT_ASSERT_NOT_NULL(test, cpu_ptr); dm_test_bo_ctx = (struct dm_test_bo_ops_ctx) {