From: Liviu Dudau <liviu.dudau@arm.com>
To: "Gustavo Kenji Mendonça Kaneko" <kaneko.dev@pm.me>
Cc: dri-devel@lists.freedesktop.org, airlied@gmail.com,
simona@ffwll.ch, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] drm/arm/komeda: fix ignored clk_prepare_enable() return value in resume
Date: Fri, 5 Jun 2026 13:17:20 +0100 [thread overview]
Message-ID: <aiK-UDx8OZMnK-2j@e142607> (raw)
In-Reply-To: <20260531052945.65117-2-kaneko.dev@pm.me>
On Sun, May 31, 2026 at 05:30:02AM +0000, Gustavo Kenji Mendonça Kaneko wrote:
> komeda_dev_resume() calls clk_prepare_enable() without checking the
> return value. If the clock fails to enable, the function returns 0
> (success) while IRQs are enabled and IOMMU is connected on potentially
> unclocked hardware, causing undefined behavior on resume.
>
> Propagate the error from clk_prepare_enable() and return early on
> failure to prevent hardware access without a valid clock.
>
> This issue was found by code review without access to Komeda hardware.
Hello,
There is nothing wrong with the content of this patch, but I would like
if anyone wants to fix these kind of problems to at least be thorough.
komeda_dev_suspend() is also ignoring the errors coming from
clk_disable_unprepare() and both fuctions before this patch always return 0,
so in komeda_drv.c we can sometimes ignore the return value. If we add
an extended version of this patch then we should also do proper error
handling in komeda_drv.c
Best regards,
Liviu
>
> Signed-off-by: Gustavo Kenji Mendonça Kaneko <kaneko.dev@pm.me>
> ---
> drivers/gpu/drm/arm/display/komeda/komeda_dev.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_dev.c b/drivers/gpu/drm/arm/display/komeda/komeda_dev.c
> index 5ba62e637a61..9aad1d1d28ec 100644
> --- a/drivers/gpu/drm/arm/display/komeda/komeda_dev.c
> +++ b/drivers/gpu/drm/arm/display/komeda/komeda_dev.c
> @@ -313,7 +313,11 @@ void komeda_dev_destroy(struct komeda_dev *mdev)
>
> int komeda_dev_resume(struct komeda_dev *mdev)
> {
> - clk_prepare_enable(mdev->aclk);
> + int err;
> +
> + err = clk_prepare_enable(mdev->aclk);
> + if (err)
> + return err;
>
> mdev->funcs->enable_irq(mdev);
>
> --
> 2.54.0
>
>
--
====================
| I would like to |
| fix the world, |
| but they're not |
| giving me the |
\ source code! /
---------------
¯\_(ツ)_/¯
next prev parent reply other threads:[~2026-06-05 12:17 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-31 5:29 [PATCH 1/2] drm/arm/malidp: fix ignored clk_prepare_enable() in runtime PM resume Gustavo Kenji Mendonça Kaneko
2026-05-31 5:30 ` [PATCH 2/2] drm/arm/komeda: fix ignored clk_prepare_enable() return value in resume Gustavo Kenji Mendonça Kaneko
2026-06-05 12:17 ` Liviu Dudau [this message]
2026-06-05 12:07 ` [PATCH 1/2] drm/arm/malidp: fix ignored clk_prepare_enable() in runtime PM resume Liviu Dudau
2026-06-05 14:20 ` Liviu Dudau
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=aiK-UDx8OZMnK-2j@e142607 \
--to=liviu.dudau@arm.com \
--cc=airlied@gmail.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=kaneko.dev@pm.me \
--cc=linux-kernel@vger.kernel.org \
--cc=simona@ffwll.ch \
/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®