From: Jiawen Liu <liu1298662399@gmail.com>
To: Ulf Hansson <ulfh@kernel.org>,
Matthias Brugger <matthias.bgg@gmail.com>,
AngeloGioacchino Del Regno
<angelogioacchino.delregno@collabora.com>
Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-mediatek@lists.infradead.org
Subject: [PATCH] pmdomain: mediatek: mfg: Handle MT8196 EB clock enable errors
Date: Sun, 29 Nov 2026 19:25:33 +0000 [thread overview]
Message-ID: <179598033854.2.10041105705350334400.pattern-ext-091.12@gmail.com> (raw)
The MT8196 variant can fail to prepare the EB clock if its provider is
removed after lookup and no managed device link serializes removal
with probe. mtk_mfg_mt8196_init() ignores the error and reads the
revision register without acquiring a clock reference. If the read
returns, the unmatched release can trigger the clock framework's
already-disabled and already-unprepared warnings when the respective
counts are zero. Variant initialization then reports success.
Return the clock error before reading the revision register. The
existing dev_err_probe() path reports and propagates the error. After
a successful clock enable, release the temporary clock reference after the
read.
Static review verified the error
and success paths, and the driver object built with arm64 defconfig.
git diff --check and checkpatch.pl passed. Runtime and hardware
reproduction were not performed.
Fixes: f08e7a4e8d6a ("pmdomain: mediatek: Add support for MFlexGraphics")
Signed-off-by: Jiawen Liu <liu1298662399@gmail.com>
---
drivers/pmdomain/mediatek/mtk-mfg-pmdomain.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/pmdomain/mediatek/mtk-mfg-pmdomain.c b/drivers/pmdomain/mediatek/mtk-mfg-pmdomain.c
index 093f8fac2a2cd..a52e71b3912af 100644
--- a/drivers/pmdomain/mediatek/mtk-mfg-pmdomain.c
+++ b/drivers/pmdomain/mediatek/mtk-mfg-pmdomain.c
@@ -597,13 +597,16 @@ static const char *const mtk_mfg_mt8196_regulators[] = {
static int mtk_mfg_mt8196_init(struct mtk_mfg *mfg)
{
void __iomem *e2_base;
+ int ret;
e2_base = devm_platform_ioremap_resource_byname(mfg->pdev, "hw-revision");
if (IS_ERR(e2_base))
return dev_err_probe(&mfg->pdev->dev, PTR_ERR(e2_base),
"Couldn't get hw-revision register\n");
- clk_prepare_enable(mfg->clk_eb);
+ ret = clk_prepare_enable(mfg->clk_eb);
+ if (ret)
+ return ret;
if (readl(e2_base) == MFG_MT8196_E2_ID)
mfg->ghpm_en_reg = RPC_DUMMY_REG_2;
--
2.34.1
reply other threads:[~2026-11-29 19:32 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=179598033854.2.10041105705350334400.pattern-ext-091.12@gmail.com \
--to=liu1298662399@gmail.com \
--cc=angelogioacchino.delregno@collabora.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux-pm@vger.kernel.org \
--cc=matthias.bgg@gmail.com \
--cc=ulfh@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
all inboxes | Powered by JetHome®