Linux Kernel Mentees list
 help / color / mirror / Atom feed
* [PATCH] ttm: Add error handling for ttm_pool_mgr_init()
@ 2026-07-31  5:30 Óscar Megía López
  2026-07-31  6:03 ` Markus Elfring
  0 siblings, 1 reply; 2+ messages in thread
From: Óscar Megía López @ 2026-07-31  5:30 UTC (permalink / raw)
  To: Christian Koenig, Huang Rui
  Cc: Óscar Megía López, Matthew Auld, Matthew Brost,
	dri-devel, linux-kernel, linux-kernel-mentees

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 <megia.oscar@gmail.com>
---
 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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] ttm: Add error handling for ttm_pool_mgr_init()
  2026-07-31  5:30 [PATCH] ttm: Add error handling for ttm_pool_mgr_init() Óscar Megía López
@ 2026-07-31  6:03 ` Markus Elfring
  0 siblings, 0 replies; 2+ messages in thread
From: Markus Elfring @ 2026-07-31  6:03 UTC (permalink / raw)
  To: Óscar Megía López, dri-devel, linux-kernel-mentees,
	Christian König, Huang Rui
  Cc: LKML, Matthew Auld, Matthew Brost

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

How do you think about to add any tags (like “Fixes” and “Cc”) accordingly?

See also:
* https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v7.2-rc5#n145
* https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/stable-kernel-rules.rst?h=v7.2-rc5#n34


Regards,
Markus

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-07-31  6:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-31  5:30 [PATCH] ttm: Add error handling for ttm_pool_mgr_init() Óscar Megía López
2026-07-31  6:03 ` Markus Elfring

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