msm: mhi: fix error handling

Validate the channel prior to proceeding further.
Unlock spin lock before jumping to error handler.

CRs-Fixed: 1016969
Change-Id: Ie3328f878b582a333ae15f3b950c258ec42fd768
Signed-off-by: Sujeev Dias <sdias@codeaurora.org>
This commit is contained in:
Sujeev Dias 2016-05-01 14:45:56 -07:00
parent fc63288a51
commit 667012017d
2 changed files with 6 additions and 2 deletions

View file

@ -625,6 +625,9 @@ static int rmnet_mhi_xmit(struct sk_buff *skb, struct net_device *dev)
tx_ring_full_count[rmnet_mhi_ptr->dev_index]++;
netif_stop_queue(dev);
rmnet_log(MSG_VERBOSE, "Stopping Queue\n");
write_unlock_irqrestore(
&rmnet_mhi_ptr->out_chan_full_lock,
flags);
goto rmnet_mhi_xmit_error_cleanup;
} else {
retry = 1;
@ -652,7 +655,6 @@ static int rmnet_mhi_xmit(struct sk_buff *skb, struct net_device *dev)
rmnet_mhi_xmit_error_cleanup:
rmnet_log(MSG_VERBOSE, "Ring full\n");
write_unlock_irqrestore(&rmnet_mhi_ptr->out_chan_full_lock, flags);
return NETDEV_TX_BUSY;
}

View file

@ -1397,8 +1397,10 @@ static int start_chan_cmd(struct mhi_device_ctxt *mhi_dev_ctxt,
u32 chan;
MHI_TRB_GET_INFO(CMD_TRB_CHID, cmd_pkt, chan);
if (!VALID_CHAN_NR(chan))
if (!VALID_CHAN_NR(chan)) {
mhi_log(MHI_MSG_ERROR, "Bad chan: 0x%x\n", chan);
return -EINVAL;
}
mhi_dev_ctxt->mhi_chan_pend_cmd_ack[chan] =
MHI_CMD_NOT_PENDING;
mhi_log(MHI_MSG_INFO, "Processed START CMD chan %d\n", chan);