msm: mhi_rmnet: clean channel resources only if allocated

It's possible for MHI host to send sys error notification
signal before sending channel enable notification. Attempt
to cleanup resources only if netdev is allocated.

CRs-Fixed: 2037971
Change-Id: I2bd1f10966a042c6f3372adff89572a5795e7daf
Signed-off-by: Sujeev Dias <sdias@codeaurora.org>
This commit is contained in:
Sujeev Dias 2017-04-20 21:47:50 -07:00
parent 048c70075f
commit c3cb01d6f0

View file

@ -983,14 +983,17 @@ static void rmnet_mhi_cb(struct mhi_cb_info *cb_info)
if (cb_info->chan == rmnet_mhi_ptr->rx_channel) {
rmnet_log(rmnet_mhi_ptr, MSG_INFO,
"Receive MHI_DISABLE notification for rx path\n");
rmnet_mhi_disable(rmnet_mhi_ptr);
if (rmnet_mhi_ptr->dev)
rmnet_mhi_disable(rmnet_mhi_ptr);
} else {
rmnet_log(rmnet_mhi_ptr, MSG_INFO,
"Receive MHI_DISABLE notification for tx path\n");
rmnet_mhi_ptr->tx_enabled = 0;
rmnet_mhi_internal_clean_unmap_buffers
(rmnet_mhi_ptr->dev, &rmnet_mhi_ptr->tx_buffers,
DMA_TO_DEVICE);
if (rmnet_mhi_ptr->dev)
rmnet_mhi_internal_clean_unmap_buffers(
rmnet_mhi_ptr->dev,
&rmnet_mhi_ptr->tx_buffers,
DMA_TO_DEVICE);
}
/* Remove all votes disabling low power mode */