Linux kernel and device drivers for NXP i.MX platforms
 help / color / mirror / Atom feed
* [PATCH] media: nxp: imx8-isi: Fix small memory leak at unbind time
@ 2026-11-30  2:23 Laurent Pinchart
  2026-11-30  2:28 ` sashiko-bot
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Laurent Pinchart @ 2026-11-30  2:23 UTC (permalink / raw)
  To: linux-media; +Cc: Frank Li, imx

The probe() function dynamically allocates the pipes array with
kzalloc_objs(), and doesn't free it at remove time. This results in a
small memory leak. Use devm_kzalloc_objs() to fix it.

Fixes: cf21f328fcaf ("media: nxp: Add i.MX8 ISI driver")
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
Not Cc'ing stable as devm_kzalloc_objs() is too new (v7.4-rc1) so
applying the patch on older kernels will fail. Manual backporting isn't
worth it as the leak is small and triggered by driver unbind only.
---
 drivers/media/platform/nxp/imx8-isi/imx8-isi-core.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/media/platform/nxp/imx8-isi/imx8-isi-core.c b/drivers/media/platform/nxp/imx8-isi/imx8-isi-core.c
index 0ae5f35e017c..9373a5256224 100644
--- a/drivers/media/platform/nxp/imx8-isi/imx8-isi-core.c
+++ b/drivers/media/platform/nxp/imx8-isi/imx8-isi-core.c
@@ -488,7 +488,8 @@ static int mxc_isi_probe(struct platform_device *pdev)
 
 	isi->pdata = of_device_get_match_data(dev);
 
-	isi->pipes = kzalloc_objs(isi->pipes[0], isi->pdata->num_channels);
+	isi->pipes = devm_kzalloc_objs(dev, isi->pipes[0],
+				       isi->pdata->num_channels);
 	if (!isi->pipes)
 		return -ENOMEM;
 

base-commit: fb8b2c10a588f1384b98280b1c32307da9db4747
-- 
Regards,

Laurent Pinchart


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

end of thread, other threads:[~2026-11-30 15:34 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-30  2:23 [PATCH] media: nxp: imx8-isi: Fix small memory leak at unbind time Laurent Pinchart
2026-11-30  2:28 ` sashiko-bot
2026-11-30  8:15 ` Paul Elder
2026-11-30 15:34 ` Frank Li

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