* [PATCH] media: nxp: imx8-isi: Fix small memory leak at unbind time
@ 2026-11-30 2:23 Laurent Pinchart
2026-11-30 8:15 ` Paul Elder
2026-11-30 15:34 ` Frank Li
0 siblings, 2 replies; 3+ 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] 3+ messages in thread
* Re: [PATCH] media: nxp: imx8-isi: Fix small memory leak at unbind time
2026-11-30 2:23 [PATCH] media: nxp: imx8-isi: Fix small memory leak at unbind time Laurent Pinchart
@ 2026-11-30 8:15 ` Paul Elder
2026-11-30 15:34 ` Frank Li
1 sibling, 0 replies; 3+ messages in thread
From: Paul Elder @ 2026-11-30 8:15 UTC (permalink / raw)
To: Laurent Pinchart, linux-media; +Cc: Frank Li, imx
Quoting Laurent Pinchart (2026-11-30 11:23:22)
> 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>
Reviewed-by: Paul Elder <paul.elder@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 [flat|nested] 3+ messages in thread
* Re: [PATCH] media: nxp: imx8-isi: Fix small memory leak at unbind time
2026-11-30 2:23 [PATCH] media: nxp: imx8-isi: Fix small memory leak at unbind time Laurent Pinchart
2026-11-30 8:15 ` Paul Elder
@ 2026-11-30 15:34 ` Frank Li
1 sibling, 0 replies; 3+ messages in thread
From: Frank Li @ 2026-11-30 15:34 UTC (permalink / raw)
To: Laurent Pinchart; +Cc: linux-media, Frank Li, imx
On Mon, Nov 30, 2026 at 11:23:22AM +0900, Laurent Pinchart wrote:
> 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>
> ---
Reviewed-by: Frank Li <Frank.Li@nxp.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 [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-11-30 15:34 UTC | newest]
Thread overview: 3+ 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 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