提交 d211ddeb 编写于 作者: C Cristian Marussi 提交者: Sudeep Holla

firmware: arm_scmi: Perform earlier cinfo lookup call in do_xfer

Lookup cinfo data early in do_xfer so as to avoid any further init work
on xfer structure in case of error.

No functional change.

Link: https://lore.kernel.org/r/20211129191156.29322-2-cristian.marussi@arm.comReviewed-by: NFlorian Fainelli <f.fainelli@gmail.com>
Signed-off-by: NCristian Marussi <cristian.marussi@arm.com>
Signed-off-by: NSudeep Holla <sudeep.holla@arm.com>
上级 afc9c1e2
...@@ -766,6 +766,10 @@ static int do_xfer(const struct scmi_protocol_handle *ph, ...@@ -766,6 +766,10 @@ static int do_xfer(const struct scmi_protocol_handle *ph,
return -EINVAL; return -EINVAL;
} }
cinfo = idr_find(&info->tx_idr, pi->proto->id);
if (unlikely(!cinfo))
return -EINVAL;
/* /*
* Initialise protocol id now from protocol handle to avoid it being * Initialise protocol id now from protocol handle to avoid it being
* overridden by mistake (or malice) by the protocol code mangling with * overridden by mistake (or malice) by the protocol code mangling with
...@@ -774,10 +778,6 @@ static int do_xfer(const struct scmi_protocol_handle *ph, ...@@ -774,10 +778,6 @@ static int do_xfer(const struct scmi_protocol_handle *ph,
xfer->hdr.protocol_id = pi->proto->id; xfer->hdr.protocol_id = pi->proto->id;
reinit_completion(&xfer->done); reinit_completion(&xfer->done);
cinfo = idr_find(&info->tx_idr, xfer->hdr.protocol_id);
if (unlikely(!cinfo))
return -EINVAL;
trace_scmi_xfer_begin(xfer->transfer_id, xfer->hdr.id, trace_scmi_xfer_begin(xfer->transfer_id, xfer->hdr.id,
xfer->hdr.protocol_id, xfer->hdr.seq, xfer->hdr.protocol_id, xfer->hdr.seq,
xfer->hdr.poll_completion); xfer->hdr.poll_completion);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册