Re: [PATCH] pinctrl: meson: sync some modify from A4

[email protected]
Newsgroups org.infradead.lists.linux-amlogic
Message-ID <[email protected]>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Returning 0 with arg=0 for disabled PIN_CONFIG_OUTPUT_ENABLE violates the pinctrl generic API and breaks debugfs dumps.
--

--- Patch [1]: [PATCH] pinctrl: meson: sync some modify from A4 ---
commit 9cd4cd52945d3531f8a1944d79a8d453a832ce33
Author: Xianwei Zhao <[email protected]>

pinctrl: meson: sync some modify from A4

This commit syncs fixes from A4, setting the drive strength before
enabling the output to prevent unintended drive strengths. It also modifies
PIN_CONFIG_OUTPUT_ENABLE to report the actual output enable state.

> diff --git a/drivers/pinctrl/meson/pinctrl-meson.c b/drivers/pinctrl/meson/pinctrl-meson.c
> index 18295b15ecd9d..9fc30aee96a56 100644
> --- a/drivers/pinctrl/meson/pinctrl-meson.c
> +++ b/drivers/pinctrl/meson/pinctrl-meson.c

[ ... ]

> @@ -498,9 +498,9 @@ static int meson_pinconf_get(struct pinctrl_dev *pcdev, unsigned int pin,
>  		break;
>  	case PIN_CONFIG_OUTPUT_ENABLE:
>  		ret = meson_pinconf_get_output(pc, pin);
> -		if (ret <= 0)
> +		if (ret < 0)
>  			return -EINVAL;
> -		arg = 1;
> +		arg = ret;

[Severity: Medium]
The generic pinctrl API defines PIN_CONFIG_OUTPUT_ENABLE as a boolean
parameter without an argument.

When a feature is inactive or disabled, drivers are expected to return 
-EINVAL from the get callback. Because the parameter has no argument, the 
core pinctrl debugfs logic ignores the returned arg value.

By returning 0 with arg = 0 when the output is disabled, won't debugfs 
falsely report all disabled pins as having their output enabled?

Should this code still return -EINVAL when ret is 0 to avoid breaking 
debugfs output?

>  		break;
>  	case PIN_CONFIG_LEVEL:

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1

_______________________________________________
linux-amlogic mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-amlogic
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.