mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-07 20:33:58 -04:00
mhi: core: Add NULL check in mhi_get_exec_env
In case power up failed due to incorrect bhi offset bhi pointer in mhi controller remains NULL. Later if MHI controller forces RDDM it checks the execution environment by accessing the BHI offset. This results into NULL pointer dereference. Fix this by adding NULL check for both mhi controller and bhi pointer before reading the BHI offset. Change-Id: I93f8918d7d595a77a5c8bcb6fd610f1a2b484fc4 Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
This commit is contained in:
parent
cef19e9ec9
commit
6e8d77cd33
1 changed files with 6 additions and 1 deletions
|
|
@ -244,8 +244,13 @@ static enum mhi_ee mhi_translate_dev_ee(struct mhi_controller *mhi_cntrl,
|
|||
|
||||
enum mhi_ee mhi_get_exec_env(struct mhi_controller *mhi_cntrl)
|
||||
{
|
||||
int ret;
|
||||
u32 exec;
|
||||
int ret = mhi_read_reg(mhi_cntrl, mhi_cntrl->bhi, BHI_EXECENV, &exec);
|
||||
|
||||
if (!mhi_cntrl || !mhi_cntrl->bhi)
|
||||
return MHI_EE_MAX;
|
||||
|
||||
ret = mhi_read_reg(mhi_cntrl, mhi_cntrl->bhi, BHI_EXECENV, &exec);
|
||||
|
||||
return (ret) ? MHI_EE_MAX : mhi_translate_dev_ee(mhi_cntrl, exec);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue