msm: mhi_dev: Skip mhi channel state info change

Fix Null pointer access when host rescans the device
by not changing the channel state info if channel is
already in disconnected or configured state.

Change-Id: I5e897d7694f958e2b9613abfd23cbc0e975e81a3
Signed-off-by: Ajay Prathi <aprathi@codeaurora.org>
tirimbino
Ajay Prathi 5 years ago committed by Gerrit - the friendly Code Review server
parent 6b42a54e38
commit bc98884b15
  1. 8
      drivers/platform/msm/mhi_dev/mhi.c

@ -2045,6 +2045,14 @@ static void mhi_update_state_info_all(enum mhi_ctrl_info info)
mhi_ctx->ctrl_info = info;
for (i = 0; i < MHI_MAX_SOFTWARE_CHANNELS; ++i) {
/*
* Skip channel state info change
* if channel is already in the desired state.
*/
if (channel_state_info[i].ctrl_info == info ||
(info == MHI_STATE_DISCONNECTED &&
channel_state_info[i].ctrl_info == MHI_STATE_CONFIGURED))
continue;
channel_state_info[i].ctrl_info = info;
/* Notify kernel clients */
mhi_dev_trigger_cb(i);

Loading…
Cancel
Save