pinctrl: rockchip: Check the error of the pmu syscon lookup
Subsystems (3)
PATCH 1/1 pinctrl: rockchip: Check the error of the pmu syscon lookup
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.
---
It's one of three related changes, but for different trees.
See https://lore.kernel.org/linux-pci/[email protected]/
This is based on the for-next branch ofgit://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(+)
drivers/pinctrl/pinctrl-rockchip.c +3 -0
@@ -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
Am Dienstag, 1. Dezember 2026, 12:33:49 Mitteleuropäische Normalzeit schrieb Anton Protopopov:
Quoted 8 lines
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 commitdbd2317d7b9f("pinctrl:
rockchip: Add rk3506 pinctrl support") the probe returned the error of the "rockchip,pmu" lookup. Now it stores the error pointer ininfo->regmap_pmu. The pin configuration code then uses an error pointer as a regmap, which leads to an oops.
Quoted 8 lines
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 <[email protected]>Signed-off-by Anton Protopopov <[email protected]>
Looked up the behaviour of syscon_regmap_lookup_by_phandle_optional(), so for the change itself:
(had a bit of fun, remembering that the 2nd syscon handling was removed by commit 9884c330dd80 ("pinctrl: rockchip: Fix RK3506 pinctrl support") )
Thanks
Heiko