aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/misc/mei/amthif.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/misc/mei/amthif.c')
-rw-r--r--drivers/misc/mei/amthif.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/drivers/misc/mei/amthif.c b/drivers/misc/mei/amthif.c
index d0fdc134068a..718f3a14c1ca 100644
--- a/drivers/misc/mei/amthif.c
+++ b/drivers/misc/mei/amthif.c
@@ -312,13 +312,13 @@ static int mei_amthif_send_cmd(struct mei_device *dev, struct mei_cl_cb *cb)
312 mei_hdr.me_addr = dev->iamthif_cl.me_client_id; 312 mei_hdr.me_addr = dev->iamthif_cl.me_client_id;
313 mei_hdr.reserved = 0; 313 mei_hdr.reserved = 0;
314 dev->iamthif_msg_buf_index += mei_hdr.length; 314 dev->iamthif_msg_buf_index += mei_hdr.length;
315 if (mei_write_message(dev, &mei_hdr, 315 ret = mei_write_message(dev, &mei_hdr, dev->iamthif_msg_buf);
316 (unsigned char *)dev->iamthif_msg_buf)) 316 if (ret)
317 return -ENODEV; 317 return ret;
318 318
319 if (mei_hdr.msg_complete) { 319 if (mei_hdr.msg_complete) {
320 if (mei_cl_flow_ctrl_reduce(&dev->iamthif_cl)) 320 if (mei_cl_flow_ctrl_reduce(&dev->iamthif_cl))
321 return -ENODEV; 321 return -EIO;
322 dev->iamthif_flow_control_pending = true; 322 dev->iamthif_flow_control_pending = true;
323 dev->iamthif_state = MEI_IAMTHIF_FLOW_CONTROL; 323 dev->iamthif_state = MEI_IAMTHIF_FLOW_CONTROL;
324 dev_dbg(&dev->pdev->dev, "add amthif cb to write waiting list\n"); 324 dev_dbg(&dev->pdev->dev, "add amthif cb to write waiting list\n");
@@ -458,6 +458,7 @@ int mei_amthif_irq_write_complete(struct mei_cl *cl, struct mei_cl_cb *cb,
458 struct mei_msg_hdr mei_hdr; 458 struct mei_msg_hdr mei_hdr;
459 size_t len = dev->iamthif_msg_buf_size - dev->iamthif_msg_buf_index; 459 size_t len = dev->iamthif_msg_buf_size - dev->iamthif_msg_buf_index;
460 u32 msg_slots = mei_data2slots(len); 460 u32 msg_slots = mei_data2slots(len);
461 int rets;
461 462
462 mei_hdr.host_addr = cl->host_client_id; 463 mei_hdr.host_addr = cl->host_client_id;
463 mei_hdr.me_addr = cl->me_client_id; 464 mei_hdr.me_addr = cl->me_client_id;
@@ -480,16 +481,17 @@ int mei_amthif_irq_write_complete(struct mei_cl *cl, struct mei_cl_cb *cb,
480 dev_dbg(&dev->pdev->dev, MEI_HDR_FMT, MEI_HDR_PRM(&mei_hdr)); 481 dev_dbg(&dev->pdev->dev, MEI_HDR_FMT, MEI_HDR_PRM(&mei_hdr));
481 482
482 *slots -= msg_slots; 483 *slots -= msg_slots;
483 if (mei_write_message(dev, &mei_hdr, 484 rets = mei_write_message(dev, &mei_hdr,
484 dev->iamthif_msg_buf + dev->iamthif_msg_buf_index)) { 485 dev->iamthif_msg_buf + dev->iamthif_msg_buf_index);
485 dev->iamthif_state = MEI_IAMTHIF_IDLE; 486 if (rets) {
486 cl->status = -ENODEV; 487 dev->iamthif_state = MEI_IAMTHIF_IDLE;
487 list_del(&cb->list); 488 cl->status = rets;
488 return -ENODEV; 489 list_del(&cb->list);
490 return rets;
489 } 491 }
490 492
491 if (mei_cl_flow_ctrl_reduce(cl)) 493 if (mei_cl_flow_ctrl_reduce(cl))
492 return -ENODEV; 494 return -EIO;
493 495
494 dev->iamthif_msg_buf_index += mei_hdr.length; 496 dev->iamthif_msg_buf_index += mei_hdr.length;
495 cl->status = 0; 497 cl->status = 0;