Skip to content

Commit 187a002

Browse files
cris-masudeep-holla
authored andcommitted
firmware: arm_scmi: Avoid padding in sensor message structure
scmi_resp_sensor_reading_complete structure is meant to represent an SCMI asynchronous reading complete message. The readings field with a 64bit type forces padding and breaks reads in scmi_sensor_reading_get. Split it in two adjacent 32bit readings_low/high subfields to avoid the padding within the structure. Alternatively we could to mark the structure packed. Link: https://lore.kernel.org/r/[email protected] Fixes: e2083d3 ("firmware: arm_scmi: Add SCMI v3.0 sensors timestamped reads") Signed-off-by: Cristian Marussi <[email protected]> Signed-off-by: Sudeep Holla <[email protected]>
1 parent b98cf55 commit 187a002

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

drivers/firmware/arm_scmi/sensors.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,8 @@ struct scmi_msg_sensor_reading_get {
166166

167167
struct scmi_resp_sensor_reading_complete {
168168
__le32 id;
169-
__le64 readings;
169+
__le32 readings_low;
170+
__le32 readings_high;
170171
};
171172

172173
struct scmi_sensor_reading_resp {
@@ -717,7 +718,8 @@ static int scmi_sensor_reading_get(const struct scmi_protocol_handle *ph,
717718

718719
resp = t->rx.buf;
719720
if (le32_to_cpu(resp->id) == sensor_id)
720-
*value = get_unaligned_le64(&resp->readings);
721+
*value =
722+
get_unaligned_le64(&resp->readings_low);
721723
else
722724
ret = -EPROTO;
723725
}

0 commit comments

Comments
 (0)