Re: [PATCH v2 4/4] PM / devfreq: Optimize error return value of governor_show()
From: Choi Chanwoo
Date: Wed Apr 29 2026 - 17:50:51 EST
2026-04-01 PM 12:31에 Yaxiong Tian 이(가) 쓴 글:
> When df->governor is NULL, governor_show() returns -EINVAL, which
> confuses users.
>
> To fix this issue, return -ENOENT to indicate that no governor is
> currently set for the device.
>
> Signed-off-by: Yaxiong Tian <tianyaxiong@xxxxxxxxxx>
> ---
> drivers/devfreq/devfreq.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c
> index 975f82d7a9d1..c40568d2a4dc 100644
> --- a/drivers/devfreq/devfreq.c
> +++ b/drivers/devfreq/devfreq.c
> @@ -1377,7 +1377,7 @@ static ssize_t governor_show(struct device *dev,
> struct devfreq *df = to_devfreq(dev);
>
> if (!df->governor)
> - return -EINVAL;
> + return -ENOENT;
>
> return sprintf(buf, "%s\n", df->governor->name);
> }
Hi,
Applied it. Thanks,
Chanwoo Choi