Re: [PATCH v10 33/36] pinctrl: airoha: try to find chip scu node by phandle first

[email protected]
Newsgroups org.kernel.vger.linux-devicetree
Message-ID <[email protected]>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Valid error codes (such as -EPROBE_DEFER or -ENOMEM) from the phandle lookup are clobbered by the fallback path, causing permanent probe failure.
--

--- Patch [33]: [PATCH v10 33/36] pinctrl: airoha: try to find chip scu node by phandle first ---
commit 1b07c88ba2b60a6919f3a1d6b55003a4983e9897
Author: Mikhail Kshevetskiy <[email protected]>

pinctrl: airoha: try to find chip scu node by phandle first

This commit updates the Airoha pinctrl driver to search for the chip SCU
regmap using a phandle first. It falls back to the SoC-specific compatible
string if the phandle lookup fails.

> diff --git a/drivers/pinctrl/airoha/pinctrl-airoha.c b/drivers/pinctrl/airoha/pinctrl-airoha.c
> --- a/drivers/pinctrl/airoha/pinctrl-airoha.c
> +++ b/drivers/pinctrl/airoha/pinctrl-airoha.c
> @@ -792,9 +792,12 @@ int airoha_pinctrl_probe(struct platform_device *pdev)
>  	if (IS_ERR(pinctrl->regmap))
>  		return PTR_ERR(pinctrl->regmap);
>  
> -	map = syscon_regmap_lookup_by_compatible("airoha,en7581-chip-scu");
> -	if (IS_ERR(map))
> -		return PTR_ERR(map);
> +	map = syscon_regmap_lookup_by_phandle(pdev->dev.of_node, "airoha,chip-scu");
> +	if (IS_ERR_OR_NULL(map)) {
> +		map = syscon_regmap_lookup_by_compatible(data->chip_scu_compatible);
> +		if (IS_ERR(map))
> +			return PTR_ERR(map);

[Severity: High]
Does this overwrite valid error codes like -EPROBE_DEFER or -ENOMEM from the
initial phandle lookup in airoha_pinctrl_probe()?

If syscon_regmap_lookup_by_phandle() correctly defers and returns
-EPROBE_DEFER, the code enters the fallback path. If the newer device tree
omits the legacy compatible string, syscon_regmap_lookup_by_compatible()
will return -ENODEV.

Since the fallback error is returned, the original -EPROBE_DEFER is dropped,
turning a transient probe deferral into a permanent probe failure. Could we
propagate the original error instead if it is something other than a missing
property?

> +	}
>  
>  	pinctrl->chip_scu = map;

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=33
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.