firmware: arm_scmi: Parse clock_enable_latency conditionally
The clock_enable_latency field in CLOCK_ATTRIBUTES response message has been added only since SCMI v3.1. Use the advertised SCMI clock protocol version as a proper condition check for parsing it, instead of the bare message length lookup. Link: https://lore.kernel.org/r/20220330150551.2573938-13-cristian.marussi@arm.com Signed-off-by: Cristian Marussi <cristian.marussi@arm.com> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
This commit is contained in:
committed by
Sudeep Holla
parent
7ad6b6ccba
commit
df3576d14a
@@ -132,8 +132,8 @@ static int scmi_clock_attributes_get(const struct scmi_protocol_handle *ph,
|
|||||||
u32 latency = 0;
|
u32 latency = 0;
|
||||||
attributes = le32_to_cpu(attr->attributes);
|
attributes = le32_to_cpu(attr->attributes);
|
||||||
strlcpy(clk->name, attr->name, SCMI_MAX_STR_SIZE);
|
strlcpy(clk->name, attr->name, SCMI_MAX_STR_SIZE);
|
||||||
/* Is optional field clock_enable_latency provided ? */
|
/* clock_enable_latency field is present only since SCMI v3.1 */
|
||||||
if (t->rx.len == sizeof(*attr))
|
if (PROTOCOL_REV_MAJOR(version) >= 0x2)
|
||||||
latency = le32_to_cpu(attr->clock_enable_latency);
|
latency = le32_to_cpu(attr->clock_enable_latency);
|
||||||
clk->enable_latency = latency ? : U32_MAX;
|
clk->enable_latency = latency ? : U32_MAX;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user