summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--drivers/input/misc/vl53L0/stmvl53l0_module-cci.c20
-rw-r--r--drivers/input/misc/vl53L0/stmvl53l0_module.c28
2 files changed, 29 insertions, 19 deletions
diff --git a/drivers/input/misc/vl53L0/stmvl53l0_module-cci.c b/drivers/input/misc/vl53L0/stmvl53l0_module-cci.c
index fecafe8db949..8520a74c9961 100644
--- a/drivers/input/misc/vl53L0/stmvl53l0_module-cci.c
+++ b/drivers/input/misc/vl53L0/stmvl53l0_module-cci.c
@@ -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);
}
- 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",
diff --git a/drivers/input/misc/vl53L0/stmvl53l0_module.c b/drivers/input/misc/vl53L0/stmvl53l0_module.c
index c46be43a03e5..27672d97448a 100644
--- a/drivers/input/misc/vl53L0/stmvl53l0_module.c
+++ b/drivers/input/misc/vl53L0/stmvl53l0_module.c
@@ -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,17 +2380,17 @@ 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(
- vl53l0_dev,
- VL53L0_CHECKENABLE_SIGNAL_RATE_FINAL_RANGE,
- 1);
- } else {
- vl53l0_errmsg(
- "SetLimitCheckEnable(SIGMA_FINAL_RANGE) failed with errcode = %d\n",
- Status);
+ if (Status == VL53L0_ERROR_NONE) {
+ Status = papi_func_tbl->SetLimitCheckEnable(
+ vl53l0_dev,
+ VL53L0_CHECKENABLE_SIGNAL_RATE_FINAL_RANGE,
+ 1);
+ } else {
+ vl53l0_errmsg(
+ "SetLimitCheckEnable(SIGMA_FINAL_RANGE) failed with errcode = %d\n",
+ Status);
+ }
}