From: Choi Chanwoo <cwchoi00@gmail.com>
To: Yaxiong Tian <tianyaxiong@kylinos.cn>
Cc: cw00.choi@samsung.com, kyungmin.park@samsung.com,
linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org,
myungjoo.ham@samsung.com, nm@ti.com, zhanjie9@hisilicon.com
Subject: Re: [PATCH v3 3/4] PM / devfreq: Fix governor_store() failing when device has no current governor
Date: Sun, 10 May 2026 21:50:22 +0900 [thread overview]
Message-ID: <bef25c54-07a4-4d4e-83b6-b520ce572c68@gmail.com> (raw)
In-Reply-To: <20260430032035.75496-1-tianyaxiong@kylinos.cn>
2026-04-30 PM 12:20에 Yaxiong Tian 이(가) 쓴 글:
> Since devfreq_remove_governor() may clear the device's current governor
> in certain situations, while governors actually exist independently
> of the device, directly returning EINVAL in this case is inaccurate.
>
> To fix this issue, remove this check and add relevant logic for when
> df->governor is NULL.
>
> Fixes: 483d557ee9a3 ("PM / devfreq: Clean up the devfreq instance name in sysfs attr")
> Co-developed-by: Choi Chanwoo <cwchoi00@gmail.com>
> Signed-off-by: Yaxiong Tian <tianyaxiong@kylinos.cn>
> ---
> drivers/devfreq/devfreq.c | 10 +++++++---
> 1 file changed, 7 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c
> index 2977b07be939..76e3700577ca 100644
> --- a/drivers/devfreq/devfreq.c
> +++ b/drivers/devfreq/devfreq.c
> @@ -1390,9 +1390,6 @@ static ssize_t governor_store(struct device *dev, struct device_attribute *attr,
> char str_governor[DEVFREQ_NAME_LEN + 1];
> const struct devfreq_governor *governor, *prev_governor;
>
> - if (!df->governor)
> - return -EINVAL;
> -
> ret = sscanf(buf, "%" __stringify(DEVFREQ_NAME_LEN) "s", str_governor);
> if (ret != 1)
> return -EINVAL;
> @@ -1403,6 +1400,9 @@ static ssize_t governor_store(struct device *dev, struct device_attribute *attr,
> ret = PTR_ERR(governor);
> goto out;
> }
> + if (!df->governor)
> + goto start_new_governor;
> +
> if (df->governor == governor) {
> ret = 0;
> goto out;
> @@ -1423,6 +1423,7 @@ static ssize_t governor_store(struct device *dev, struct device_attribute *attr,
> goto out;
> }
>
> +start_new_governor:
> /*
> * Start the new governor and create the specific sysfs files
> * which depend on the new governor.
> @@ -1436,6 +1437,9 @@ static ssize_t governor_store(struct device *dev, struct device_attribute *attr,
>
> /* Restore previous governor */
> df->governor = prev_governor;
> + if (!df->governor)
> + goto out;
> +
> ret = df->governor->event_handler(df, DEVFREQ_GOV_START, NULL);
> if (ret) {
> dev_err(dev,
I'm sorr for late reply. I applied it.
Thanks,
Chanwoo Choi
next prev parent reply other threads:[~2026-05-10 12:50 UTC|newest]
Thread overview: 21+ 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-05-10 12:50 ` Choi Chanwoo [this message]
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
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=bef25c54-07a4-4d4e-83b6-b520ce572c68@gmail.com \
--to=cwchoi00@gmail.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 \
--cc=zhanjie9@hisilicon.com \
/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