diff mbox series

[v3] firmware: arm_scmi: Refrain set operations of perf

Message ID 20231109082855.472681-1-xinglong.yang@cixtech.com (mailing list archive)
State New, archived
Headers show
Series [v3] firmware: arm_scmi: Refrain set operations of perf | expand

Commit Message

xinglong.yang Nov. 9, 2023, 8:28 a.m. UTC
Refrain from trying to take the SET operation where the set_* operations
are not supported, because: (1.) avoid unneeded SCMI exchanges, (2.)
avoids to trust the FW reply blindly.

Signed-off-by: xinglong.yang <xinglong.yang@cixtech.com>
---
 drivers/firmware/arm_scmi/perf.c | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Sudeep Holla Nov. 16, 2023, 6:25 p.m. UTC | #1
On Thu, 09 Nov 2023 16:28:55 +0800, xinglong.yang wrote:
> Refrain from trying to take the SET operation where the set_* operations
> are not supported, because: (1.) avoid unneeded SCMI exchanges, (2.)
> avoids to trust the FW reply blindly.
>
>

Applied to sudeep.holla/linux (for-next/scmi/updates), thanks!

[1/1] firmware: arm_scmi: Refrain set operations of perf
      https://git.kernel.org/sudeep.holla/c/189df98777a3
--
Regards,
Sudeep
diff mbox series

Patch

diff --git a/drivers/firmware/arm_scmi/perf.c b/drivers/firmware/arm_scmi/perf.c
index c2435be0ae1b..f5a063b0b1ab 100644
--- a/drivers/firmware/arm_scmi/perf.c
+++ b/drivers/firmware/arm_scmi/perf.c
@@ -504,6 +504,9 @@  static int scmi_perf_limits_set(const struct scmi_protocol_handle *ph,
 	if (IS_ERR(dom))
 		return PTR_ERR(dom);
 
+	if (!dom->set_limits)
+		return -EOPNOTSUPP;
+
 	if (PROTOCOL_REV_MAJOR(pi->version) >= 0x3 && !max_perf && !min_perf)
 		return -EINVAL;
 
@@ -654,6 +657,9 @@  static int scmi_perf_level_set(const struct scmi_protocol_handle *ph,
 	if (IS_ERR(dom))
 		return PTR_ERR(dom);
 
+	if (!dom->info.set_perf)
+		return -EOPNOTSUPP;
+
 	if (dom->level_indexing_mode) {
 		struct scmi_opp *opp;