Linux kernel and device drivers for NXP i.MX platforms
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: Zhipeng.wang_1@oss.nxp.com
Cc: Frank.Li@kernel.org, conor+dt@kernel.org,
	devicetree@vger.kernel.org, imx@lists.linux.dev, robh@kernel.org
Subject: Re: [PATCH v2 2/2] pmdomain: imx: scu-pd: allow building as a module
Date: Wed, 22 Jul 2026 03:39:19 +0000	[thread overview]
Message-ID: <20260722033920.200701F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260722032321.2693300-3-Zhipeng.wang_1@oss.nxp.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Changing IMX_SCU_PD to a tristate exposes a critical probe order race condition with the SCU clock driver, leading to unpowered hardware and system crashes.
--

--- Patch [2]: [PATCH v2 2/2] pmdomain: imx: scu-pd: allow building as a module ---
commit d3bf08bb865becc5d6316a0d9e70a9dbcc5e5ef3
Author: Zhipeng Wang <zhipeng.wang_1@nxp.com>

pmdomain: imx: scu-pd: allow building as a module

This commit converts CONFIG_IMX_SCU_PD to tristate to allow building as a
loadable module, which is required for Android Generic Kernel Image (GKI)
support. It adds MODULE_DEVICE_TABLE and a module_init function since the
driver cannot be safely removed.

> diff --git a/drivers/pmdomain/imx/Kconfig b/drivers/pmdomain/imx/Kconfig
> index 00203615c65e9..472e9dec6bd4e 100644
> --- a/drivers/pmdomain/imx/Kconfig
> +++ b/drivers/pmdomain/imx/Kconfig
> @@ -21,7 +21,7 @@ config IMX9_BLK_CTRL
>  	depends on PM_GENERIC_DOMAINS
>  
>  config IMX_SCU_PD
> -	bool "IMX SCU Power Domain driver"
> +	tristate "IMX SCU Power Domain driver"

[Severity: High]
Does allowing this driver to be built as a module expose a probe order
race condition with the SCU clock driver?

If the power domain driver is loaded asynchronously after the SCU clock
driver (clk-imx8qxp), the clock-controller DT node lacks a power-domains
property, so fw_devlink cannot enforce the correct probe order.

In this scenario, the clock driver manually looks up the power domain
provider using of_find_compatible_node() and calls of_genpd_add_device().
If the power domain driver has not probed yet, genpd_get_from_provider()
will fail and return -ENOENT.

The clock driver ignores this error in imx_clk_scu_alloc_dev() and
registers the clock device without attaching it to the PM domain. When
the clock is later requested, the Common Clock Framework's
pm_runtime_resume_and_get() will succeed passively because there is no
attached PM domain.

Can this lead to system crashes or hardware access faults due to
accessing unpowered hardware?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260722032321.2693300-1-Zhipeng.wang_1@oss.nxp.com?part=2

      reply	other threads:[~2026-07-22  3:39 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-22  3:23 [PATCH v2 0/2] pmdomain: imx: build the SCU power domain driver as a module Zhipeng.wang_1
2026-07-22  3:23 ` [PATCH v2 1/2] of: export of_stdout symbol Zhipeng.wang_1
2026-07-22  3:23 ` [PATCH v2 2/2] pmdomain: imx: scu-pd: allow building as a module Zhipeng.wang_1
2026-07-22  3:39   ` 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=20260722033920.200701F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=Frank.Li@kernel.org \
    --cc=Zhipeng.wang_1@oss.nxp.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=imx@lists.linux.dev \
    --cc=robh@kernel.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox