[PATCH v2] firmware: arm_scmi: Refrain set operations of perf
xinglong.yang
seanyang230 at gmail.com
Thu Nov 2 00:58:53 PDT 2023
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 at cixtech.com>
---
drivers/firmware/arm_scmi/perf.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/firmware/arm_scmi/perf.c b/drivers/firmware/arm_scmi/perf.c
index 431bda9165c3..3bcdef91ed5c 100644
--- a/drivers/firmware/arm_scmi/perf.c
+++ b/drivers/firmware/arm_scmi/perf.c
@@ -377,6 +377,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;
@@ -473,6 +476,9 @@ static int scmi_perf_level_set(const struct scmi_protocol_handle *ph,
if (IS_ERR(dom))
return PTR_ERR(dom);
+ if (!dom->set_perf)
+ return -EOPNOTSUPP;
+
if (dom->fc_info && dom->fc_info[PERF_FC_LEVEL].set_addr) {
struct scmi_fc_info *fci = &dom->fc_info[PERF_FC_LEVEL];
--
2.42.0
More information about the linux-arm-kernel
mailing list