mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Anton Protopopov <a.s.protopopov@gmail.com>
To: Linus Walleij <linusw@kernel.org>,
	Heiko Stuebner <heiko@sntech.de>,
	Ye Zhang <ye.zhang@rock-chips.com>,
	linux-gpio@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org
Cc: Anton Protopopov <a.s.protopopov@gmail.com>,
	Bjorn Helgaas <bhelgaas@google.com>
Subject: [PATCH] pinctrl: rockchip: Check the error of the pmu syscon lookup
Date: Tue,  1 Dec 2026 11:33:49 +0000	[thread overview]
Message-ID: <20261201113351.342509-1-a.s.protopopov@gmail.com> (raw)

The syscon_regmap_lookup_by_phandle_optional() function returns NULL
only when the property is missing (-ENODEV). On other errors it
returns an error pointer. Before commit dbd2317d7b9f ("pinctrl:
rockchip: Add rk3506 pinctrl support") the probe returned the error
of the "rockchip,pmu" lookup. Now it stores the error pointer in
info->regmap_pmu. The pin configuration code then uses an error
pointer as a regmap, which leads to an oops.

The lookup may fail with a correct device tree too: it returns
-EPROBE_DEFER when the hwspinlock of the syscon or the driver which
registers its regmap is not probed yet. Return the error from the
probe, so that it is retried.

Fixes: dbd2317d7b9f ("pinctrl: rockchip: Add rk3506 pinctrl support")
Suggested-by: Bjorn Helgaas <bhelgaas@google.com>
Signed-off-by: Anton Protopopov <a.s.protopopov@gmail.com>
---

It's one of three related changes, but for different trees.
See https://lore.kernel.org/linux-pci/20261127101915.1348807-1-a.s.protopopov@gmail.com/

This is based on the for-next branch of
git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl.git
and applies to its fixes branch too.

 drivers/pinctrl/pinctrl-rockchip.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/pinctrl/pinctrl-rockchip.c b/drivers/pinctrl/pinctrl-rockchip.c
index cad602fa41ae..76e6ce2d52bc 100644
--- a/drivers/pinctrl/pinctrl-rockchip.c
+++ b/drivers/pinctrl/pinctrl-rockchip.c
@@ -5022,6 +5022,9 @@ static int rockchip_pinctrl_probe(struct platform_device *pdev)
 
 	/* try to find the optional reference to the pmu syscon */
 	info->regmap_pmu = syscon_regmap_lookup_by_phandle_optional(np, "rockchip,pmu");
+	if (IS_ERR(info->regmap_pmu))
+		return dev_err_probe(dev, PTR_ERR(info->regmap_pmu),
+				     "failed to look up pmu syscon\n");
 
 	if (ctrl->type == RK3308) {
 		ret = rk3308_soc_data_init(info);

base-commit: 948b743d6ce070e3d6a31806b8aab4f151e69178

             reply	other threads:[~2026-12-01 11:22 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-01 11:33 Anton Protopopov [this message]
2026-12-01 12:13 ` Heiko Stübner

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=20261201113351.342509-1-a.s.protopopov@gmail.com \
    --to=a.s.protopopov@gmail.com \
    --cc=bhelgaas@google.com \
    --cc=heiko@sntech.de \
    --cc=linusw@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=ye.zhang@rock-chips.com \
    /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®