diff --git a/drivers/platform/msm/mhi_dev/mhi.c b/drivers/platform/msm/mhi_dev/mhi.c index 46ba74e89570..80320c19045e 100644 --- a/drivers/platform/msm/mhi_dev/mhi.c +++ b/drivers/platform/msm/mhi_dev/mhi.c @@ -2171,15 +2171,14 @@ static void mhi_dev_process_ring_pending(struct work_struct *work) } ch = &mhi->ch[ring->id - mhi->ch_ring_start]; - mutex_lock(&ch->ch_lock); rc = mhi_dev_process_ring(ring); if (rc) { mhi_log(MHI_MSG_ERROR, "error processing ring %d\n", ring->id); - mutex_unlock(&ch->ch_lock); goto exit; } + mutex_lock(&ch->ch_lock); ch->db_pending = false; if (ch->reset_pending) { @@ -3262,9 +3261,9 @@ int mhi_dev_read_channel(struct mhi_req *mreq) mutex_lock(&ch->ch_lock); do { - if (ch->state == MHI_DEV_CH_STOPPED) { + if (ch->state == MHI_DEV_CH_STOPPED || ch->reset_pending) { mhi_log(MHI_MSG_VERBOSE, - "channel (%d) already stopped\n", + "channel (%d) already stopped or RST pending\n", mreq->chan); bytes_read = -1; goto exit; @@ -3445,9 +3444,10 @@ int mhi_dev_write_channel(struct mhi_req *wreq) } ch->pend_wr_count++; - if (ch->state == MHI_DEV_CH_STOPPED) { + if (ch->state == MHI_DEV_CH_STOPPED || ch->reset_pending) { mhi_log(MHI_MSG_ERROR, - "channel %d already stopped\n", wreq->chan); + "channel %d already stopped or RST pending\n", + wreq->chan); bytes_written = -1; goto exit; }