Merge "i2c-msm-v2: Avoid accessing unassigned memory"
This commit is contained in:
commit
d6f171ce52
1 changed files with 8 additions and 11 deletions
|
@ -2232,19 +2232,8 @@ static int i2c_msm_pm_clk_enable(struct i2c_msm_ctrl *ctrl)
|
|||
static int i2c_msm_pm_xfer_start(struct i2c_msm_ctrl *ctrl)
|
||||
{
|
||||
int ret;
|
||||
struct i2c_msm_xfer *xfer = &ctrl->xfer;
|
||||
mutex_lock(&ctrl->xfer.mtx);
|
||||
|
||||
/* if system is suspended just bail out */
|
||||
if (ctrl->pwr_state == I2C_MSM_PM_SYS_SUSPENDED) {
|
||||
struct i2c_msg *msgs = xfer->msgs + xfer->cur_buf.msg_idx;
|
||||
dev_err(ctrl->dev,
|
||||
"slave:0x%x is calling xfer when system is suspended\n",
|
||||
msgs->addr);
|
||||
mutex_unlock(&ctrl->xfer.mtx);
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
i2c_msm_pm_pinctrl_state(ctrl, true);
|
||||
pm_runtime_get_sync(ctrl->dev);
|
||||
/*
|
||||
|
@ -2330,6 +2319,14 @@ i2c_msm_frmwrk_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], int num)
|
|||
return PTR_ERR(msgs);
|
||||
}
|
||||
|
||||
/* if system is suspended just bail out */
|
||||
if (ctrl->pwr_state == I2C_MSM_PM_SYS_SUSPENDED) {
|
||||
dev_err(ctrl->dev,
|
||||
"slave:0x%x is calling xfer when system is suspended\n",
|
||||
msgs->addr);
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
ret = i2c_msm_pm_xfer_start(ctrl);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
|
Loading…
Add table
Reference in a new issue