From: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
To: David Carlier <devnexen@gmail.com>
Cc: dan.scally@ideasonboard.com, jacopo.mondi@ideasonboard.com,
mchehab@kernel.org, nayden.kanchev@arm.com,
hverkuil+cisco@kernel.org, linux-media@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v4 1/3] media: mali-c55: add missing of_reserved_mem_device_release()
Date: Sat, 28 Mar 2026 17:47:44 +0100 [thread overview]
Message-ID: <acgGB8K8ostsDhlZ@zed> (raw)
In-Reply-To: <20260328151452.148901-1-devnexen@gmail.com>
Hi David
On Sat, Mar 28, 2026 at 03:14:50PM +0000, David Carlier wrote:
> mali_c55_probe() calls of_reserved_mem_device_init() to associate
> reserved memory regions with the device. This function allocates a
> struct rmem_assigned_device and adds it to a global linked list, which
> must be explicitly released via of_reserved_mem_device_release() — there
> is no devm variant of this API.
>
> However, neither the probe error paths nor mali_c55_remove() called
> of_reserved_mem_device_release(). Any probe failure after the
> of_reserved_mem_device_init() call, as well as every normal device
> removal, leaked the reserved memory association on the global list.
>
> Fix this by adding an err_release_mem label at the end of the probe
> error chain and calling of_reserved_mem_device_release() in
> mali_c55_remove(). The remove teardown order is also corrected to call
> mali_c55_media_frameworks_deinit() before kfree(), mirroring the probe
> init order in reverse.
>
> Fixes: d5f281f3dd29 ("media: mali-c55: Add Mali-C55 ISP driver")
> Signed-off-by: David Carlier <devnexen@gmail.com>
Seems like you forgot my tag here:
Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Thanks
j
> ---
> drivers/media/platform/arm/mali-c55/mali-c55-core.c | 11 ++++++++---
> 1 file changed, 8 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/media/platform/arm/mali-c55/mali-c55-core.c b/drivers/media/platform/arm/mali-c55/mali-c55-core.c
> index c1a562cd214e..5cb59c70ffc9 100644
> --- a/drivers/media/platform/arm/mali-c55/mali-c55-core.c
> +++ b/drivers/media/platform/arm/mali-c55/mali-c55-core.c
> @@ -806,8 +806,10 @@ static int mali_c55_probe(struct platform_device *pdev)
> vb2_dma_contig_set_max_seg_size(dev, UINT_MAX);
>
> ret = __mali_c55_power_on(mali_c55);
> - if (ret)
> - return dev_err_probe(dev, ret, "failed to power on\n");
> + if (ret) {
> + dev_err_probe(dev, ret, "failed to power on\n");
> + goto err_release_mem;
> + }
>
> ret = mali_c55_check_hwcfg(mali_c55);
> if (ret)
> @@ -846,6 +848,8 @@ static int mali_c55_probe(struct platform_device *pdev)
> kfree(mali_c55->context.registers);
> err_power_off:
> __mali_c55_power_off(mali_c55);
> +err_release_mem:
> + of_reserved_mem_device_release(dev);
>
> return ret;
> }
> @@ -854,8 +858,9 @@ static void mali_c55_remove(struct platform_device *pdev)
> {
> struct mali_c55 *mali_c55 = platform_get_drvdata(pdev);
>
> - kfree(mali_c55->context.registers);
> mali_c55_media_frameworks_deinit(mali_c55);
> + kfree(mali_c55->context.registers);
> + of_reserved_mem_device_release(&pdev->dev);
> }
>
> static const struct of_device_id mali_c55_of_match[] = {
> --
> 2.53.0
>
next prev parent reply other threads:[~2026-03-28 16:47 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-28 15:14 [PATCH v4 1/3] media: mali-c55: add missing of_reserved_mem_device_release() David Carlier
2026-03-28 15:14 ` [PATCH v4 2/3] media: mali-c55: Power-off the peripheral in remove() David Carlier
2026-03-28 15:14 ` [PATCH v4 3/3] media: mali-c55: fix probe error path skipping pm_runtime_disable() David Carlier
2026-03-28 16:48 ` Jacopo Mondi
2026-03-28 16:47 ` Jacopo Mondi [this message]
[not found] <20260328151452.148901-1-devnexen@gmail.co>
2026-03-28 17:04 ` [PATCH v4 1/3] media: mali-c55: add missing of_reserved_mem_device_release() David Carlier
2026-03-28 17:44 ` Jacopo Mondi
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=acgGB8K8ostsDhlZ@zed \
--to=jacopo.mondi@ideasonboard.com \
--cc=dan.scally@ideasonboard.com \
--cc=devnexen@gmail.com \
--cc=hverkuil+cisco@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=nayden.kanchev@arm.com \
/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