mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] drm/tests: Initialize framebuffer's filp_head in drm_test_framebuffer_free()
@ 2025-06-28 14:23 Sasha Levin
  0 siblings, 0 replies; only message in thread
From: Sasha Levin @ 2025-06-28 14:23 UTC (permalink / raw)
  To: maarten.lankhorst, mripard, tzimmermann
  Cc: airlied, simona, dri-devel, linux-kernel, Sasha Levin

The drm_test_framebuffer_free() test creates a framebuffer on the stack
without properly initializing the filp_head list, causing the following
warning when drm_framebuffer_free() checks it:

[  144.996969] drm-kunit-mock-device drm_test_framebuffer_free.drm-kunit-mock-device: [drm] drm_WARN_ON(\!list_empty(&fb->filp_head))
[  144.997097] WARNING: CPU: 0 PID: 2546 at drivers/gpu/drm/drm_framebuffer.c:832 drm_framebuffer_free+0x13f/0x1c0

The test intentionally creates a partially initialized framebuffer
to test an edge case in drm_framebuffer_free(), but it needs to
initialize the filp_head list to avoid triggering the warning on
uninitialized list data.

Initialize the filp_head list in the test to match the behavior of
drm_framebuffer_init().

Fixes: d21942560499 ("drm/tests: Add test for drm_framebuffer_free()")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/gpu/drm/tests/drm_framebuffer_test.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/tests/drm_framebuffer_test.c b/drivers/gpu/drm/tests/drm_framebuffer_test.c
index 6ea04cc8f3241..81a7f2cfb8ed6 100644
--- a/drivers/gpu/drm/tests/drm_framebuffer_test.c
+++ b/drivers/gpu/drm/tests/drm_framebuffer_test.c
@@ -677,6 +677,7 @@ static void drm_test_framebuffer_free(struct kunit *test)
 	};
 	int id, ret;
 
+	INIT_LIST_HEAD(&fb.filp_head);
 	priv->buffer_freed = false;
 
 	/*
-- 
2.39.5


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2025-06-28 14:23 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-06-28 14:23 [PATCH] drm/tests: Initialize framebuffer's filp_head in drm_test_framebuffer_free() Sasha Levin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®