From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Rosen Penev <rosenp@gmail.com>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>,
Frank Li <Frank.Li@nxp.com>,
Sascha Hauer <s.hauer@pengutronix.de>,
Dong Aisheng <aisheng.dong@nxp.com>,
Guoniu Zhou <guoniu.zhou@nxp.com>,
Jacopo Mondi <jacopo@jmondi.org>,
Stefan Riedmueller <s.riedmueller@phytec.de>,
Pengutronix Kernel Team <kernel@pengutronix.de>,
Fabio Estevam <festevam@gmail.com>,
Christian Hemp <c.hemp@phytec.de>,
linux-media@vger.kernel.org, imx@lists.linux.dev,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3] media: nxp: imx8-isi: remove kzalloc_objs
Date: Wed, 11 Nov 2026 09:15:38 +0200 [thread overview]
Message-ID: <20261111071538.GD86558@killaraus.ideasonboard.com> (raw)
In-Reply-To: <20261111022822.67474-1-rosenp@gmail.com>
Please see my comments on v1.
On Tue, Nov 10, 2026 at 06:28:22PM -0800, Rosen Penev wrote:
> Use a flexible array member to combine allocations.
>
> It looks like pipes never gets freed anywhere. Meaning this effectively
> fixes a memory leak.
>
> Fixes: cf21f328fcaf ("media: nxp: Add i.MX8 ISI driver")
> Signed-off-by: Rosen Penev <rosenp@gmail.com>
> ---
> v3: use devm_kzalloc_flex
> v2: add fixes tag, fix typo, and move pdata assignment to original
> place.
> drivers/media/platform/nxp/imx8-isi/imx8-isi-core.c | 10 ++++------
> drivers/media/platform/nxp/imx8-isi/imx8-isi-core.h | 3 ++-
> 2 files changed, 6 insertions(+), 7 deletions(-)
>
> 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 2005584a1215..dcf6c25d7faa 100644
> --- a/drivers/media/platform/nxp/imx8-isi/imx8-isi-core.c
> +++ b/drivers/media/platform/nxp/imx8-isi/imx8-isi-core.c
> @@ -473,24 +473,22 @@ static const struct dev_pm_ops mxc_isi_pm_ops = {
>
> static int mxc_isi_probe(struct platform_device *pdev)
> {
> + const struct mxc_isi_plat_data *pdata;
> struct device *dev = &pdev->dev;
> struct mxc_isi_dev *isi;
> unsigned int dma_size;
> unsigned int i;
> int ret = 0;
>
> - isi = devm_kzalloc_obj(dev, *isi);
> + pdata = of_device_get_match_data(dev);
> + isi = devm_kzalloc_flex(dev, *isi, pipes, pdata->num_channels);
> if (!isi)
> return -ENOMEM;
>
> isi->dev = dev;
> platform_set_drvdata(pdev, isi);
>
> - isi->pdata = of_device_get_match_data(dev);
> -
> - isi->pipes = kzalloc_objs(isi->pipes[0], isi->pdata->num_channels);
> - if (!isi->pipes)
> - return -ENOMEM;
> + isi->pdata = pdata;
>
> isi->num_clks = devm_clk_bulk_get_all(dev, &isi->clks);
> if (isi->num_clks < 0)
> diff --git a/drivers/media/platform/nxp/imx8-isi/imx8-isi-core.h b/drivers/media/platform/nxp/imx8-isi/imx8-isi-core.h
> index 58b47335afc7..3165a65391c1 100644
> --- a/drivers/media/platform/nxp/imx8-isi/imx8-isi-core.h
> +++ b/drivers/media/platform/nxp/imx8-isi/imx8-isi-core.h
> @@ -297,7 +297,6 @@ struct mxc_isi_dev {
> struct regmap *gasket;
>
> struct mxc_isi_crossbar crossbar;
> - struct mxc_isi_pipe *pipes;
> struct mxc_isi_m2m m2m;
>
> struct media_device media_dev;
> @@ -305,6 +304,8 @@ struct mxc_isi_dev {
> struct v4l2_async_notifier notifier;
>
> struct dentry *debugfs_root;
> +
> + struct mxc_isi_pipe pipes[];
> };
>
> extern const struct mxc_gasket_ops mxc_imx8_gasket_ops;
--
Regards,
Laurent Pinchart
prev parent reply other threads:[~2026-11-11 7:15 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-11 2:28 Rosen Penev
2026-11-11 7:15 ` Laurent Pinchart [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=20261111071538.GD86558@killaraus.ideasonboard.com \
--to=laurent.pinchart@ideasonboard.com \
--cc=Frank.Li@nxp.com \
--cc=aisheng.dong@nxp.com \
--cc=c.hemp@phytec.de \
--cc=festevam@gmail.com \
--cc=guoniu.zhou@nxp.com \
--cc=imx@lists.linux.dev \
--cc=jacopo@jmondi.org \
--cc=kernel@pengutronix.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=rosenp@gmail.com \
--cc=s.hauer@pengutronix.de \
--cc=s.riedmueller@phytec.de \
/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
all inboxes | Powered by JetHome®