summaryrefslogtreecommitdiff
path: root/drivers/bus/mhi/core/main.c
diff options
context:
space:
mode:
authorJani Nikula <jani.nikula@intel.com>2021-08-16 09:11:17 +0300
committerJani Nikula <jani.nikula@intel.com>2021-08-16 09:11:17 +0300
commitb2eb7d716426fe056596761cd371005d64e9caec (patch)
tree436d0566cf4bc900522c9dbf1e203234ef65b2f7 /drivers/bus/mhi/core/main.c
parent2817efaeb608421d8f6fe7939826c35a852644e9 (diff)
parent2819cf0e7dbe45a2bccf2f6c60fe6a27b299cc3e (diff)
downloadlinux-b2eb7d716426fe056596761cd371005d64e9caec.tar.xz
Merge drm/drm-next into drm-intel-next
Catch up with drm core changes. Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Diffstat (limited to 'drivers/bus/mhi/core/main.c')
-rw-r--r--drivers/bus/mhi/core/main.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/drivers/bus/mhi/core/main.c b/drivers/bus/mhi/core/main.c
index 22acde118bc3..fc9196f11cb7 100644
--- a/drivers/bus/mhi/core/main.c
+++ b/drivers/bus/mhi/core/main.c
@@ -773,11 +773,18 @@ static void mhi_process_cmd_completion(struct mhi_controller *mhi_cntrl,
cmd_pkt = mhi_to_virtual(mhi_ring, ptr);
chan = MHI_TRE_GET_CMD_CHID(cmd_pkt);
- mhi_chan = &mhi_cntrl->mhi_chan[chan];
- write_lock_bh(&mhi_chan->lock);
- mhi_chan->ccs = MHI_TRE_GET_EV_CODE(tre);
- complete(&mhi_chan->completion);
- write_unlock_bh(&mhi_chan->lock);
+
+ if (chan < mhi_cntrl->max_chan &&
+ mhi_cntrl->mhi_chan[chan].configured) {
+ mhi_chan = &mhi_cntrl->mhi_chan[chan];
+ write_lock_bh(&mhi_chan->lock);
+ mhi_chan->ccs = MHI_TRE_GET_EV_CODE(tre);
+ complete(&mhi_chan->completion);
+ write_unlock_bh(&mhi_chan->lock);
+ } else {
+ dev_err(&mhi_cntrl->mhi_dev->dev,
+ "Completion packet for invalid channel ID: %d\n", chan);
+ }
mhi_del_ring_element(mhi_cntrl, mhi_ring);
}