[PATCH] pinctrl: rockchip: Check the error of the pmu syscon lookup
From: Anton Protopopov
Date: Tue Dec 01 2026 - 06:22:28 EST
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@xxxxxxxxxx>
Signed-off-by: Anton Protopopov <a.s.protopopov@xxxxxxxxx>
---
It's one of three related changes, but for different trees.
See https://lore.kernel.org/linux-pci/20261127101915.1348807-1-a.s.protopopov@xxxxxxxxx/
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