Thread (2 messages) 2 messages, 2 authors, 2026-07-31

[PATCH] ttm: Add error handling for ttm_pool_mgr_init()

flat view
STALE73d

From: Óscar Megía López <hidden>
Date: 2026-07-31 05:31:09
Also in: dri-devel, lkml
Subsystem: drm drivers, drm drivers and misc gpu patches, drm ttm subsystem, the rest · Maintainers: David Airlie, Simona Vetter, Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, Christian Koenig, Huang Rui, Linus Torvalds

The ttm_pool_mgr_init() function can fail, but its return value was
previously ignored in ttm_global_init(). This could leave the pool
manager in an invalid state while the system continues initialization.

Fix this by checking the return code and jumping to the error path
on failure.

Assisted-by: OpenCode:1.17.8-Big Pickle
Signed-off-by: Óscar Megía López <redacted>
---
 drivers/gpu/drm/ttm/ttm_device.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/ttm/ttm_device.c b/drivers/gpu/drm/ttm/ttm_device.c
index d3bfb9a696a7..c880a0430363 100644
--- a/drivers/gpu/drm/ttm/ttm_device.c
+++ b/drivers/gpu/drm/ttm/ttm_device.c
@@ -96,7 +96,10 @@ static int ttm_global_init(void)
 		>> PAGE_SHIFT;
 	num_dma32 = min(num_dma32, 2UL << (30 - PAGE_SHIFT));
 
-	ttm_pool_mgr_init(num_pages);
+	ret = ttm_pool_mgr_init(num_pages);
+	if (ret)
+		goto out;
+
 	ttm_tt_mgr_init(num_pages, num_dma32);
 
 	glob->dummy_read_page = alloc_page(__GFP_ZERO | GFP_DMA32 |
-- 
2.55.0
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help