Merge "input: stm: Fix NULL dereference in laser driver"
This commit is contained in:
commit
9a95bce25c
2 changed files with 29 additions and 19 deletions
|
@ -111,11 +111,11 @@ static int stmvl53l0_get_dt_data(struct device *dev, struct cci_data *data)
|
|||
vl53l0_errmsg("failed %d\n", __LINE__);
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
vl53l0_dbgmsg("vreg-name: %s min_volt: %d max_volt: %d",
|
||||
vreg_cfg->cam_vreg->reg_name,
|
||||
vreg_cfg->cam_vreg->min_voltage,
|
||||
vreg_cfg->cam_vreg->max_voltage);
|
||||
}
|
||||
|
||||
rc = msm_sensor_driver_get_gpio_data(&(data->gconf), of_node);
|
||||
if ((rc < 0) || (data->gconf == NULL)) {
|
||||
|
@ -289,6 +289,11 @@ static int32_t stmvl53l0_platform_probe(struct platform_device *pdev)
|
|||
if (vl53l0_data) {
|
||||
vl53l0_data->client_object =
|
||||
kzalloc(sizeof(struct cci_data), GFP_KERNEL);
|
||||
if (!vl53l0_data->client_object) {
|
||||
rc = -ENOMEM;
|
||||
kfree(vl53l0_data);
|
||||
return rc;
|
||||
}
|
||||
cci_object = (struct cci_data *)vl53l0_data->client_object;
|
||||
}
|
||||
cci_object->client =
|
||||
|
@ -380,6 +385,11 @@ int stmvl53l0_power_up_cci(void *cci_object, unsigned int *preset_flag)
|
|||
vl53l0_dbgmsg("Enter");
|
||||
|
||||
/* need to init cci first */
|
||||
if (!data) {
|
||||
pr_err("%s:%d failed\n", __func__, __LINE__);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
ret = stmvl53l0_cci_init(data);
|
||||
if (ret) {
|
||||
vl53l0_errmsg("stmvl53l0_cci_init failed %d\n", __LINE__);
|
||||
|
@ -429,7 +439,7 @@ int stmvl53l0_power_up_cci(void *cci_object, unsigned int *preset_flag)
|
|||
}
|
||||
|
||||
/* actual power up */
|
||||
if (data && data->device_type == MSM_CAMERA_PLATFORM_DEVICE) {
|
||||
if (data->device_type == MSM_CAMERA_PLATFORM_DEVICE) {
|
||||
ret = stmvl53l0_vreg_control(data, 1);
|
||||
if (ret < 0) {
|
||||
vl53l0_errmsg("stmvl53l0_vreg_control failed %d\n",
|
||||
|
|
|
@ -2115,10 +2115,10 @@ static int stmvl53l0_init_client(struct stmvl53l0_data *data)
|
|||
VL53L0_Error Status = VL53L0_ERROR_NONE;
|
||||
VL53L0_DeviceInfo_t DeviceInfo;
|
||||
VL53L0_DEV vl53l0_dev = data;
|
||||
uint32_t refSpadCount;
|
||||
uint8_t isApertureSpads;
|
||||
uint8_t VhvSettings;
|
||||
uint8_t PhaseCal;
|
||||
uint32_t refSpadCount = 0;
|
||||
uint8_t isApertureSpads = 0;
|
||||
uint8_t VhvSettings = 0;
|
||||
uint8_t PhaseCal = 0;
|
||||
|
||||
|
||||
vl53l0_dbgmsg("Enter\n");
|
||||
|
@ -2380,7 +2380,6 @@ static int stmvl53l0_config_use_case(struct stmvl53l0_data *data)
|
|||
vl53l0_dev,
|
||||
VL53L0_CHECKENABLE_SIGMA_FINAL_RANGE,
|
||||
1);
|
||||
}
|
||||
|
||||
if (Status == VL53L0_ERROR_NONE) {
|
||||
Status = papi_func_tbl->SetLimitCheckEnable(
|
||||
|
@ -2392,6 +2391,7 @@ static int stmvl53l0_config_use_case(struct stmvl53l0_data *data)
|
|||
"SetLimitCheckEnable(SIGMA_FINAL_RANGE) failed with errcode = %d\n",
|
||||
Status);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (Status == VL53L0_ERROR_NONE) {
|
||||
|
|
Loading…
Add table
Reference in a new issue