mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] intel-gtt: fix an error handle in i810_setup()
@ 2026-01-25 12:23 Haoxiang Li
  2026-01-26 12:16 ` Markus Elfring
  0 siblings, 1 reply; 2+ messages in thread
From: Haoxiang Li @ 2026-01-25 12:23 UTC (permalink / raw)
  To: airlied, chris, simona.vetter
  Cc: dri-devel, linux-kernel, Haoxiang Li, stable

In i810_setup(), if ioremap() fails, the memory allocated
by alloc_gatt_pages() should be freed. Add free_gatt_pages()
to do so.

Fixes: 820647b97a9c ("intel-gtt: switch i81x to the common initialization helpers")
Cc: stable@vger.kernel.org
Signed-off-by: Haoxiang Li <lihaoxiang@isrc.iscas.ac.cn>
---
 drivers/char/agp/intel-gtt.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/char/agp/intel-gtt.c b/drivers/char/agp/intel-gtt.c
index bcc26785175d..dfb6282ce401 100644
--- a/drivers/char/agp/intel-gtt.c
+++ b/drivers/char/agp/intel-gtt.c
@@ -186,8 +186,10 @@ static int i810_setup(void)
 	reg_addr = pci_resource_start(intel_private.pcidev, I810_MMADR_BAR);
 
 	intel_private.registers = ioremap(reg_addr, KB(64));
-	if (!intel_private.registers)
+	if (!intel_private.registers) {
+		free_gatt_pages(intel_private.i81x_gtt_table, I810_GTT_ORDER);
 		return -ENOMEM;
+	}
 
 	writel(virt_to_phys(gtt_table) | I810_PGETBL_ENABLED,
 	       intel_private.registers+I810_PGETBL_CTL);
-- 
2.25.1


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

* Re: [PATCH] intel-gtt: fix an error handle in i810_setup()
  2026-01-25 12:23 [PATCH] intel-gtt: fix an error handle in i810_setup() Haoxiang Li
@ 2026-01-26 12:16 ` Markus Elfring
  0 siblings, 0 replies; 2+ messages in thread
From: Markus Elfring @ 2026-01-26 12:16 UTC (permalink / raw)
  To: Haoxiang Li, dri-devel
  Cc: stable, LKML, Dave Airlie, Jianhao Xu, Simona Vetter, Zilin Guan

> In i810_setup(), if ioremap() fails, the memory allocated
> by alloc_gatt_pages() should be freed. Add free_gatt_pages()
> to do so.

* Were any source code analysis tools involved here?

* Would the term “exception handling” be more appropriate than “an error handle”?


Regards,
Markus

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

end of thread, other threads:[~2026-01-26 12:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-01-25 12:23 [PATCH] intel-gtt: fix an error handle in i810_setup() Haoxiang Li
2026-01-26 12:16 ` Markus Elfring

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®