From: sashiko-bot@kernel.org
To: "Manush Prajwal" <manushprajwal555@gmail.com>
Cc: linux-clk@vger.kernel.org, imx@lists.linux.dev, Frank.Li@kernel.org
Subject: Re: [PATCH] clk: imx: clk-imx95-blk-ctl: fix error unwinding in probe
Date: Wed, 11 Nov 2026 11:21:08 +0000 [thread overview]
Message-ID: <sashiko-outbox-208862@kernel.org> (raw)
In-Reply-To: <6af44b5c.67914289.fe7ab.6559@mx.google.com>
Thank you for your contribution! Sashiko AI review found no new issues
in this patch, but noticed 1 related pre-existing issue it does not
introduce:
- [High] clk: imx: uninitialized register overwrite in
imx95_bc_runtime_resume() [1]
--
commit 19a6efb010aee7e2b721c30ed7ad173ca7b7d1df
Author: Manush Prajwal <manushprajwal555@gmail.com>
clk: imx: clk-imx95-blk-ctl: fix error unwinding in probe
This commit fixes error handling in imx95_bc_probe() by checking runtime PM
return values, dropping the runtime PM reference on failure, and disabling
bc->clk_apb on error paths.
> diff --git a/drivers/clk/imx/clk-imx95-blk-ctl.c b/drivers/clk/imx/clk-imx95-blk-ctl.c
> index bc6957299ceca..ad386a48ec2bb 100644
> --- a/drivers/clk/imx/clk-imx95-blk-ctl.c
> +++ b/drivers/clk/imx/clk-imx95-blk-ctl.c
> @@ -394,17 +394,29 @@ static int imx95_bc_probe(struct platform_device *pdev)
[ ... ]
> if (bc->pdata->rpm_enabled) {
> - devm_pm_runtime_enable(&pdev->dev);
> - pm_runtime_resume_and_get(&pdev->dev);
> + ret = devm_pm_runtime_enable(&pdev->dev);
> + if (ret)
> + goto err_clk_disable;
> +
> + ret = pm_runtime_resume_and_get(&pdev->dev);
> + if (ret)
> + goto err_clk_disable;
> }
[Severity: High]
This problem wasn't introduced by this patch, but doesn't calling
pm_runtime_resume_and_get() here [1] overwrite the hardware clock
control register with zero before any state has been saved?
bc is allocated with devm_kzalloc(), so bc->clk_reg_restore is initially
0. When pm_runtime_resume_and_get() runs during probe, it synchronously
invokes imx95_bc_runtime_resume():
drivers/clk/imx/clk-imx95-blk-ctl.c:imx95_bc_runtime_resume() {
...
writel(bc->clk_reg_restore, bc->base + bc->pdata->clk_reg_offset);
return 0;
}
Writing the uninitialized zero value clobbers the clock gate and mux
settings configured by the bootloader, disabling active clocks and hanging
dependent blocks such as display or LVDS. Initializing
bc->clk_reg_restore from the register before enabling runtime PM (or
calling pm_runtime_set_active() before devm_pm_runtime_enable()) would
preserve the hardware state.
[1] https://sashiko.dev/#/bug/linux-2f2aa951-60e6-4afb-8098-949100502ab9
--
Sashiko AI review · https://sashiko.dev/#/patchset/6af44b5c.67914289.fe7ab.6559@mx.google.com?part=1
prev parent reply other threads:[~2026-11-11 11:21 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-11 11:02 [PATCH] clk: imx: clk-imx95-blk-ctl: fix error unwinding in probe Manush Prajwal
2026-11-11 11:21 ` sashiko-bot [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=sashiko-outbox-208862@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=Frank.Li@kernel.org \
--cc=imx@lists.linux.dev \
--cc=linux-clk@vger.kernel.org \
--cc=manushprajwal555@gmail.com \
--cc=sashiko-reviews@lists.linux.dev \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.