firmware: arm_scmi: Relax CLOCK_DESCRIBE_RATES out-of-spec checks
authorCristian Marussi <cristian.marussi@arm.com>
Thu, 16 Jun 2022 17:03:47 +0000 (18:03 +0100)
committerSudeep Holla <sudeep.holla@arm.com>
Mon, 20 Jun 2022 09:17:33 +0000 (10:17 +0100)
commit754f04cac362417b157e30d5dc4046b5ec92060c
treec0f1f79fdfbc15fadc335bce1b11a12c1f74987c
parent44dbdf3bb3f44bf08897ed5f22eb262edcf3d926
firmware: arm_scmi: Relax CLOCK_DESCRIBE_RATES out-of-spec checks

A reply to CLOCK_DESCRIBE_RATES issued against a non rate-discrete clock
should be composed of a triplet of rates descriptors (min/max/step)
returned all in one reply message.

This is not always the case when dealing with some SCMI server deployed in
the wild: relax such constraint while maintaining memory safety by checking
carefully the returned payload size.

While at that cleanup a stale debug printout.

Link: https://lore.kernel.org/r/20220616170347.2800771-1-cristian.marussi@arm.com
Fixes: 7bc7caafe6b1 ("firmware: arm_scmi: Use common iterators in the clock protocol")
Tested-by: Robin Murphy <robin.murphy@arm.com>
Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
drivers/firmware/arm_scmi/clock.c
drivers/firmware/arm_scmi/driver.c
drivers/firmware/arm_scmi/protocols.h