firmware: arm_scmi: Move reinit_completion from scmi_xfer_get to do_xfer

Re-using timed out xfers in a loop can lead to issue if completion was
not properly reinitialized. Move reinit_completion from scmi_xfer_get to
do_xfer to avoid the issue.

Link: https://lore.kernel.org/r/20210606221232.33768-3-cristian.marussi@arm.com
Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>
[sudeep.holla: moved reinit_completion instead of adding another one]
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
This commit is contained in:
Cristian Marussi 2021-06-06 23:12:24 +01:00 committed by Sudeep Holla
parent f1748b1ee1
commit e30d91d4ff
1 changed files with 1 additions and 1 deletions

View File

@ -241,7 +241,6 @@ static struct scmi_xfer *scmi_xfer_get(const struct scmi_handle *handle,
xfer = &minfo->xfer_block[xfer_id];
xfer->hdr.seq = xfer_id;
reinit_completion(&xfer->done);
xfer->transfer_id = atomic_inc_return(&transfer_last_id);
return xfer;
@ -438,6 +437,7 @@ static int do_xfer(const struct scmi_protocol_handle *ph,
* the scmi_xfer structure.
*/
xfer->hdr.protocol_id = pi->proto->id;
reinit_completion(&xfer->done);
cinfo = idr_find(&info->tx_idr, xfer->hdr.protocol_id);
if (unlikely(!cinfo))