Linux kernel and device drivers for NXP i.MX platforms
 help / color / mirror / Atom feed
From: Frank Li <Frank.li@oss.nxp.com>
To: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: linux-media@vger.kernel.org, Frank Li <Frank.Li@nxp.com>,
	imx@lists.linux.dev
Subject: Re: [PATCH] media: nxp: imx8-isi: Fix small memory leak at unbind time
Date: Mon, 30 Nov 2026 09:34:23 -0600	[thread overview]
Message-ID: <aw2XfxAXc7tkhduh@SMW015318> (raw)
In-Reply-To: <20261130022322.22508-1-laurent.pinchart@ideasonboard.com>

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
>
>

      parent reply	other threads:[~2026-11-30 15:34 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aw2XfxAXc7tkhduh@SMW015318 \
    --to=frank.li@oss.nxp.com \
    --cc=Frank.Li@nxp.com \
    --cc=imx@lists.linux.dev \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-media@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox