mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-25 05:34:00 +08:00
mei: consolidate repeating code in mei_cl_irq_read_msg
A cb is always placed on the completion queue during discarding queue. Hence this can be performed upon discard. Signed-off-by: Tomas Winkler <tomas.winkler@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
c836790ae5
commit
17ba8a08b5
@ -118,7 +118,6 @@ int mei_cl_irq_read_msg(struct mei_cl *cl,
|
|||||||
|
|
||||||
if (!mei_cl_is_connected(cl)) {
|
if (!mei_cl_is_connected(cl)) {
|
||||||
cl_dbg(dev, cl, "not connected\n");
|
cl_dbg(dev, cl, "not connected\n");
|
||||||
list_move_tail(&cb->list, &complete_list->list);
|
|
||||||
cb->status = -ENODEV;
|
cb->status = -ENODEV;
|
||||||
goto discard;
|
goto discard;
|
||||||
}
|
}
|
||||||
@ -128,8 +127,6 @@ int mei_cl_irq_read_msg(struct mei_cl *cl,
|
|||||||
if (buf_sz < cb->buf_idx) {
|
if (buf_sz < cb->buf_idx) {
|
||||||
cl_err(dev, cl, "message is too big len %d idx %zu\n",
|
cl_err(dev, cl, "message is too big len %d idx %zu\n",
|
||||||
mei_hdr->length, cb->buf_idx);
|
mei_hdr->length, cb->buf_idx);
|
||||||
|
|
||||||
list_move_tail(&cb->list, &complete_list->list);
|
|
||||||
cb->status = -EMSGSIZE;
|
cb->status = -EMSGSIZE;
|
||||||
goto discard;
|
goto discard;
|
||||||
}
|
}
|
||||||
@ -137,8 +134,6 @@ int mei_cl_irq_read_msg(struct mei_cl *cl,
|
|||||||
if (cb->buf.size < buf_sz) {
|
if (cb->buf.size < buf_sz) {
|
||||||
cl_dbg(dev, cl, "message overflow. size %zu len %d idx %zu\n",
|
cl_dbg(dev, cl, "message overflow. size %zu len %d idx %zu\n",
|
||||||
cb->buf.size, mei_hdr->length, cb->buf_idx);
|
cb->buf.size, mei_hdr->length, cb->buf_idx);
|
||||||
|
|
||||||
list_move_tail(&cb->list, &complete_list->list);
|
|
||||||
cb->status = -EMSGSIZE;
|
cb->status = -EMSGSIZE;
|
||||||
goto discard;
|
goto discard;
|
||||||
}
|
}
|
||||||
@ -158,6 +153,8 @@ int mei_cl_irq_read_msg(struct mei_cl *cl,
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
discard:
|
discard:
|
||||||
|
if (cb)
|
||||||
|
list_move_tail(&cb->list, &complete_list->list);
|
||||||
mei_irq_discard_msg(dev, mei_hdr);
|
mei_irq_discard_msg(dev, mei_hdr);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user