mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Gustavo Kenji Mendonça Kaneko" <kaneko.dev@pm.me>
To: dri-devel@lists.freedesktop.org
Cc: liviu.dudau@arm.com, airlied@gmail.com, simona@ffwll.ch,
	linux-kernel@vger.kernel.org,
	"Gustavo Kenji Mendonça Kaneko" <kaneko.dev@pm.me>
Subject: [PATCH 2/2] drm/arm/komeda: fix ignored clk_prepare_enable() return value in resume
Date: Sun, 31 May 2026 05:30:02 +0000	[thread overview]
Message-ID: <20260531052945.65117-2-kaneko.dev@pm.me> (raw)
In-Reply-To: <20260531052945.65117-1-kaneko.dev@pm.me>

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.

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



  reply	other threads:[~2026-05-31  5:30 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 ` Gustavo Kenji Mendonça Kaneko [this message]
2026-06-05 12:17   ` [PATCH 2/2] drm/arm/komeda: fix ignored clk_prepare_enable() return value in resume Liviu Dudau
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=20260531052945.65117-2-kaneko.dev@pm.me \
    --to=kaneko.dev@pm.me \
    --cc=airlied@gmail.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=liviu.dudau@arm.com \
    --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®