Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Cristian Marussi and committed by
Sudeep Holla
df3576d1 7ad6b6cc

+2 -2
+2 -2
drivers/firmware/arm_scmi/clock.c
··· 132 132 u32 latency = 0; 133 133 attributes = le32_to_cpu(attr->attributes); 134 134 strlcpy(clk->name, attr->name, SCMI_MAX_STR_SIZE); 135 - /* Is optional field clock_enable_latency provided ? */ 136 - if (t->rx.len == sizeof(*attr)) 135 + /* clock_enable_latency field is present only since SCMI v3.1 */ 136 + if (PROTOCOL_REV_MAJOR(version) >= 0x2) 137 137 latency = le32_to_cpu(attr->clock_enable_latency); 138 138 clk->enable_latency = latency ? : U32_MAX; 139 139 }