Skip to content

Commit

Permalink
bus: mhi: ep: Check if the channel is supported by the controller
Browse files Browse the repository at this point in the history
Before processing the command ring for the channel, check if the channel is
supported by the controller or not.

Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Reviewed-by: Jeffrey Hugo <quic_jhugo@quicinc.com>
Link: https://lore.kernel.org/r/20221228161704.255268-3-manivannan.sadhasivam@linaro.org
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
  • Loading branch information
Manivannan Sadhasivam committed Jan 27, 2023
1 parent 47a1dca commit 6de4941
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions drivers/bus/mhi/ep/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,13 @@ static int mhi_ep_process_cmd_ring(struct mhi_ep_ring *ring, struct mhi_ring_ele
int ret;

ch_id = MHI_TRE_GET_CMD_CHID(el);

/* Check if the channel is supported by the controller */
if ((ch_id > mhi_cntrl->max_chan) || !mhi_cntrl->mhi_chan[ch_id].name) {
dev_err(dev, "Channel (%u) not supported!\n", ch_id);
return -ENODEV;
}

mhi_chan = &mhi_cntrl->mhi_chan[ch_id];
ch_ring = &mhi_cntrl->mhi_chan[ch_id].ring;

Expand Down

0 comments on commit 6de4941

Please sign in to comment.