From: Chanwoo Choi <chanwoo@kernel.org>
To: Riwen Lu <luriwen@kylinos.cn>,
myungjoo.ham@samsung.com, kyungmin.park@samsung.com,
cw00.choi@samsung.com
Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v1 2/2] PM: devfreq: handle invalid parameters gracefully in simpleondemand
Date: Mon, 24 Nov 2025 00:24:40 +0900 [thread overview]
Message-ID: <25a5c859-357f-4e31-9b47-822d0c32ce70@kernel.org> (raw)
In-Reply-To: <20251118032339.2799230-2-luriwen@kylinos.cn>
25. 11. 18. 12:23에 Riwen Lu 이(가) 쓴 글:
> Instead of returning -EINVAL when upthreshold > 100 or upthreshold <
> downdifferential, fall back to default threshold values to ensure the
> governor continues functioning.
>
> Additionally, the validation is now scoped to the if (data) block,
> preventing unnecessary checks when no user data is provided, while the
> fallback mechanism ensures reliability with invalid configurations.
>
> Signed-off-by: Riwen Lu <luriwen@kylinos.cn>
> ---
> drivers/devfreq/governor_simpleondemand.c | 11 ++++++++---
> 1 file changed, 8 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/devfreq/governor_simpleondemand.c b/drivers/devfreq/governor_simpleondemand.c
> index b4d7be766f33..7205891d2ec6 100644
> --- a/drivers/devfreq/governor_simpleondemand.c
> +++ b/drivers/devfreq/governor_simpleondemand.c
> @@ -36,10 +36,15 @@ static int devfreq_simple_ondemand_func(struct devfreq *df,
> dfso_upthreshold = data->upthreshold;
> if (data->downdifferential)
> dfso_downdifferential = data->downdifferential;
> +
> + if (dfso_upthreshold > 100 ||
> + dfso_upthreshold < dfso_downdifferential) {
> + dfso_upthreshold = DFSO_UPTHRESHOLD;
> + dfso_downdifferential = DFSO_DOWNDIFFERENTIAL;
> + pr_debug("Invalid thresholds, using defaults: up = %u, down = %u\n",
> + dfso_upthreshold, dfso_downdifferential);
> + }
> }
> - if (dfso_upthreshold > 100 ||
> - dfso_upthreshold < dfso_downdifferential)
> - return -EINVAL;
>
> /* Assume MAX if it is going to be divided by zero */
> if (stat->total_time == 0) {
If there are wrong initialization of devfreq_simple_ondemand,
it should point out what is wrong because it makes some confusion if there are no error.
--
Best Regards,
Samsung Electronics
Chanwoo Choi
next prev parent reply other threads:[~2025-11-23 15:24 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-18 3:23 [PATCH v1 1/2] PM: devfreq: fix typo in DFSO_DOWNDIFFERENTIAL macro name Riwen Lu
2025-11-18 3:23 ` [PATCH v1 2/2] PM: devfreq: handle invalid parameters gracefully in simpleondemand Riwen Lu
2025-11-23 15:24 ` Chanwoo Choi [this message]
2025-11-26 9:24 ` luriwen
2025-11-23 15:20 ` [PATCH v1 1/2] PM: devfreq: fix typo in DFSO_DOWNDIFFERENTIAL macro name Chanwoo Choi
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=25a5c859-357f-4e31-9b47-822d0c32ce70@kernel.org \
--to=chanwoo@kernel.org \
--cc=cw00.choi@samsung.com \
--cc=kyungmin.park@samsung.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=luriwen@kylinos.cn \
--cc=myungjoo.ham@samsung.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
all inboxes | Powered by JetHome®