From: Jie Zhan <zhanjie9@hisilicon.com>
To: Yaxiong Tian <tianyaxiong@kylinos.cn>, <myungjoo.ham@samsung.com>,
<kyungmin.park@samsung.com>, <cw00.choi@samsung.com>, <nm@ti.com>
Cc: <linux-pm@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2 4/4] PM / devfreq: Optimize error return value of governor_show()
Date: Thu, 2 Apr 2026 11:38:07 +0800 [thread overview]
Message-ID: <7fddbd0f-0d17-4e4b-925d-155964ad45b3@hisilicon.com> (raw)
In-Reply-To: <20260401033128.67925-1-tianyaxiong@kylinos.cn>
On 4/1/2026 11:31 AM, Yaxiong Tian wrote:
> 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@kylinos.cn>
> ---
> 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;
Hi Yaxiong,
Usually we don't change sysfs error code because that might break userspace
if it depends on this to do some specific handling (although it shouldn't
do so!)
Besides that, from a user-friendliness point of view, I'd still prefer
ENODEV.
A user terminal is supposed to get "No such file" on -ENOENT and "No such
device" on -ENODEV.
I guess the latter is more meaningful since 'device' can mean 'object'?
"No such file" is a bit confusing because the sysfs file or entry is
clearly there.
Thanks,
Jie
>
> return sprintf(buf, "%s\n", df->governor->name);
> }
next prev parent reply other threads:[~2026-04-02 3:38 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-01 3:28 [PATCH v2 0/4] Fix some errors in the devfreq core layer when governor is NULL Yaxiong Tian
2026-04-01 3:30 ` [PATCH v2 1/4] PM / devfreq: Fix possible null pointer issue in devfreq_add_governor() Yaxiong Tian
2026-04-02 3:06 ` Jie Zhan
2026-04-29 21:49 ` Choi Chanwoo
2026-04-01 3:30 ` [PATCH v2 2/4] PM / devfreq: Fix available_governors_show() when no governor is set Yaxiong Tian
2026-04-02 3:10 ` Jie Zhan
2026-04-29 21:49 ` Choi Chanwoo
2026-04-01 3:31 ` [PATCH v2 3/4] PM / devfreq: Fix governor_store() failing when device has no current governor Yaxiong Tian
2026-04-02 3:21 ` Jie Zhan
2026-04-02 5:47 ` Yaxiong Tian
2026-04-02 6:52 ` Jie Zhan
2026-04-29 22:28 ` Choi Chanwoo
2026-04-30 3:29 ` Yaxiong Tian
2026-04-30 3:20 ` [PATCH v3 " Yaxiong Tian
2026-04-01 3:31 ` [PATCH v2 4/4] PM / devfreq: Optimize error return value of governor_show() Yaxiong Tian
2026-04-02 3:38 ` Jie Zhan [this message]
2026-04-29 21:50 ` Choi Chanwoo
2026-04-28 2:50 ` [PATCH v2 0/4] Fix some errors in the devfreq core layer when governor is NULL Jie Zhan
2026-04-28 2:59 ` Yaxiong Tian
2026-04-29 2:04 ` Jie Zhan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7fddbd0f-0d17-4e4b-925d-155964ad45b3@hisilicon.com \
--to=zhanjie9@hisilicon.com \
--cc=cw00.choi@samsung.com \
--cc=kyungmin.park@samsung.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=myungjoo.ham@samsung.com \
--cc=nm@ti.com \
--cc=tianyaxiong@kylinos.cn \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox