From: sashiko-bot@kernel.org
To: "Sasha Finkelstein" <k@chaosmail.tech>
Cc: devicetree@vger.kernel.org, conor+dt@kernel.org, robh@kernel.org
Subject: Re: [PATCH 3/3] arm64: dts: apple: Add pmgr-misc nodes to t60xx
Date: Thu, 02 Jul 2026 12:29:03 +0000 [thread overview]
Message-ID: <20260702122904.1B5B21F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260702-pmgr-misc-v1-3-4f075a3a95c1@chaosmail.tech>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] Pre-existing error handling bug where the return value of `devm_platform_ioremap_resource_byname()` is incorrectly checked against NULL instead of IS_ERR, leading to an invalid pointer dereference.
--
commit 7d3a9b5b08e4210f6d81e35e862b055c17a322ad
Author: Sasha Finkelstein <k@chaosmail.tech>
arm64: dts: apple: Add pmgr-misc nodes to t60xx
This patch adds the PMGR misc control nodes to the device tree for the M1/2
Pro, Max, and Ultra series devices. It defines the register regions and
power domains for these power-management nodes.
> diff --git a/arch/arm64/boot/dts/apple/t600x-die0.dtsi b/arch/arm64/boot/dts/apple/t600x-die0.dtsi
> index f715b19efd167..3271d234b483a 100644
> --- a/arch/arm64/boot/dts/apple/t600x-die0.dtsi
> +++ b/arch/arm64/boot/dts/apple/t600x-die0.dtsi
> @@ -24,6 +24,13 @@ aic: interrupt-controller@28e100000 {
> power-domains = <&ps_aic>;
> };
>
> + pmgr_misc: power-management@28e20c000 {
> + compatible = "apple,t6000-pmgr-misc";
> + reg = <0x2 0x8e20c000 0 0x400>,
> + <0x2 0x8e20c800 0 0x400>;
> + reg-names = "fabric-ps", "dcs-ps";
> + };
> +
[Severity: High]
This isn't a bug introduced by this patch, but adding this device tree node
will trigger the probe function in drivers/soc/apple/apple-pmgr-misc.c, which
has a pre-existing error handling issue.
Could this cause a kernel panic during boot if the resource fails to map?
In drivers/soc/apple/apple-pmgr-misc.c:apple_pmgr_init_device(), the
resource mapping is handled like this:
base = devm_platform_ioremap_resource_byname(
to_platform_device(misc->dev), name);
if (!base)
return false;
val = readl_relaxed(base + APPLE_CLKGEN_PSTATE);
Should this check be IS_ERR(base) instead of !base?
If the resource mapping fails, devm_platform_ioremap_resource_byname()
returns an ERR_PTR (such as ERR_PTR(-EINVAL)). The !base check will evaluate
to false, allowing the error pointer to be directly dereferenced as a
memory address by readl_relaxed().
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260702-pmgr-misc-v1-0-4f075a3a95c1@chaosmail.tech?part=3
prev parent reply other threads:[~2026-07-02 12:29 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-02 12:06 [PATCH 0/3] soc: apple: Add "PMGR misc" power controls driver Sasha Finkelstein
2026-07-02 12:06 ` [PATCH 1/3] dt-bindings: soc: apple: Add bindings for apple PMGR misc controls Sasha Finkelstein
2026-07-02 19:18 ` Conor Dooley
2026-07-02 19:35 ` Sasha Finkelstein
2026-07-03 9:52 ` Krzysztof Kozlowski
2026-07-02 12:06 ` [PATCH 2/3] soc: apple: Add driver for Apple " Sasha Finkelstein
2026-07-02 12:23 ` sashiko-bot
2026-07-02 12:06 ` [PATCH 3/3] arm64: dts: apple: Add pmgr-misc nodes to t60xx Sasha Finkelstein
2026-07-02 12:29 ` 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=20260702122904.1B5B21F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=k@chaosmail.tech \
--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 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.