]> git.baikalelectronics.ru Git - kernel.git/commit
firmware: arm_scmi: Fix incorrect error propagation in scmi_voltage_descriptors_get
authorLudvig Pärsson <ludvig.parsson@axis.com>
Fri, 10 Jun 2022 14:00:55 +0000 (16:00 +0200)
committerSudeep Holla <sudeep.holla@arm.com>
Sun, 12 Jun 2022 18:59:55 +0000 (19:59 +0100)
commit0aa894c5f3d005e49ed5ef0434d9c343190f18c0
tree8f7489ae086c3069827840d49358fa3ebe943e4b
parent85e530ca741d110714a58eabfbf7703235a759aa
firmware: arm_scmi: Fix incorrect error propagation in scmi_voltage_descriptors_get

scmi_voltage_descriptors_get() will incorrecly return an error code if
the last iteration of the for loop that retrieves the descriptors is
skipped due to an error. Skipping an iteration in the loop is not an
error, but the `ret` value from the last iteration will be propagated
when the function returns.

Fix by not saving return values that should not be propagated. This
solution also minimizes the risk of future patches accidentally
re-introducing this bug.

Link: https://lore.kernel.org/r/20220610140055.31491-1-ludvig.parsson@axis.com
Reviewed-by: Cristian Marussi <cristian.marussi@arm.com>
Signed-off-by: Ludvig Pärsson <ludvig.parsson@axis.com>
[sudeep.holla: Removed unneeded reset_rx_to_maxsz and check for return
value from scmi_voltage_levels_get as suggested by Cristian]
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
drivers/firmware/arm_scmi/voltage.c