mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Bean Huo <beanhuo@iokpp.de>
To: Chanwoo Choi <cw00.choi@samsung.com>,
	MyungJoo Ham <myungjoo.ham@samsung.com>,
	Kyungmin Park <kyungmin.park@samsung.com>
Cc: Bean Huo <beanhuo@micron.com>, Jie Zhan <zhanjie9@hisilicon.com>,
	Avri Altman <avri.altman@sandisk.com>,
	linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-scsi@vger.kernel.org
Subject: [PATCH v3 0/2] PM / devfreq: check the get_cur_freq() return value
Date: Thu, 26 Nov 2026 23:32:23 +0100	[thread overview]
Message-ID: <20261126223225.2257410-1-beanhuo@iokpp.de> (raw)

From: Bean Huo <beanhuo@micron.com>

devfreq_set_target() does not check the return value of the optional
->get_cur_freq() callback, so a failing callback can leave an
uninitialized frequency in freqs.old for the transition notifiers.
Patch 1 fixes that by falling back to previous_freq, like the other two
callers already do. Patch 2 writes down what a driver is expected to
return from the callback.

v2 had four patches. Martin applied patches 3 and 4 (the ufshcd part)
to the SCSI tree, so this v3 only has the two devfreq patches.

Changes since v2:
- Patch 1: do not call ->get_cur_freq() inside the if condition. Read
  the frequency into a local variable and only use it when the callback
  returns 0, as Chanwoo suggested. Behavior is the same as in v2. I kept
  the Reviewed-by tags from Avri and Jie, since only the form of the
  code changed; please tell me if that is not OK.
- Patch 1 and 2: add Reviewed-by from Jie Zhan.
- Patch 2: add Acked-by from Chanwoo Choi. No change in the patch.

v2: https://lore.kernel.org/all/20260907192140.2701755-1-beanhuo@iokpp.de/

Bean Huo (2):
  PM / devfreq: Fall back to previous_freq when get_cur_freq() fails
  PM / devfreq: Add more details to the get_cur_freq() comment

 drivers/devfreq/devfreq.c | 12 +++++++-----
 include/linux/devfreq.h   |  7 +++++--
 2 files changed, 12 insertions(+), 7 deletions(-)


base-commit: 4ff20abe28d65a0c52f0b280008fcfb93c3ee2b2
-- 
2.34.1


             reply	other threads:[~2026-11-26 22:32 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-26 22:32 Bean Huo [this message]
2026-11-26 22:32 ` [PATCH v3 1/2] PM / devfreq: Fall back to previous_freq when get_cur_freq() fails Bean Huo
2026-11-26 22:32 ` [PATCH v3 2/2] PM / devfreq: Add more details to the get_cur_freq() comment Bean Huo

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=20261126223225.2257410-1-beanhuo@iokpp.de \
    --to=beanhuo@iokpp.de \
    --cc=avri.altman@sandisk.com \
    --cc=beanhuo@micron.com \
    --cc=cw00.choi@samsung.com \
    --cc=kyungmin.park@samsung.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=myungjoo.ham@samsung.com \
    --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

all inboxes | Powered by JetHome®