mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] media: cx25821: Fix a resource leak in cx25821_dev_setup()
@ 2026-01-03  7:46 Haoxiang Li
  2026-01-03 15:22 ` Markus Elfring
  0 siblings, 1 reply; 2+ messages in thread
From: Haoxiang Li @ 2026-01-03  7:46 UTC (permalink / raw)
  To: mchehab; +Cc: linux-media, linux-kernel, Haoxiang Li

Add release_mem_region() if ioremap() fails to release the memory
region obtained by cx25821_get_resources().

Signed-off-by: Haoxiang Li <lihaoxiang@isrc.iscas.ac.cn>
---
 drivers/media/pci/cx25821/cx25821-core.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/media/pci/cx25821/cx25821-core.c b/drivers/media/pci/cx25821/cx25821-core.c
index 6627fa9166d3..a7336be44474 100644
--- a/drivers/media/pci/cx25821/cx25821-core.c
+++ b/drivers/media/pci/cx25821/cx25821-core.c
@@ -908,6 +908,7 @@ static int cx25821_dev_setup(struct cx25821_dev *dev)
 
 	if (!dev->lmmio) {
 		CX25821_ERR("ioremap failed, maybe increasing __VMALLOC_RESERVE in page.h\n");
+		release_mem_region(dev->base_io_addr, pci_resource_len(dev->pci, 0));
 		cx25821_iounmap(dev);
 		return -ENOMEM;
 	}
-- 
2.25.1


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

* Re: [PATCH] media: cx25821: Fix a resource leak in cx25821_dev_setup()
  2026-01-03  7:46 [PATCH] media: cx25821: Fix a resource leak in cx25821_dev_setup() Haoxiang Li
@ 2026-01-03 15:22 ` Markus Elfring
  0 siblings, 0 replies; 2+ messages in thread
From: Markus Elfring @ 2026-01-03 15:22 UTC (permalink / raw)
  To: Haoxiang Li, linux-media, Mauro Carvalho Chehab; +Cc: LKML

> Add release_mem_region() if ioremap() fails to release the memory
> region obtained by cx25821_get_resources().

Do you try to synchronise resource release actions with information
from the implementation of the function “cx25821_dev_unregister”?
https://elixir.bootlin.com/linux/v6.19-rc3/source/drivers/media/pci/cx25821/cx25821-core.c#L939-L963

How do you think about to add any tags (like “Fixes” and “Cc”) accordingly?
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v6.19-rc3#n145

Regards,
Markus

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

end of thread, other threads:[~2026-01-03 15:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-01-03  7:46 [PATCH] media: cx25821: Fix a resource leak in cx25821_dev_setup() Haoxiang Li
2026-01-03 15:22 ` 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®