[PATCH] ttm: Add error handling for ttm_pool_mgr_init()
Óscar Megía López <[email protected]> Fri, 31 Jul 2026 07:30:36 +0200
| Newsgroups | dev.linux.lists.linux-kernel-mentees,org.freedesktop.lists.dri-devel,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <[email protected]> |
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 <[email protected]> --- 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