msm: camera: Avoid unwanted variable overwrite in i2c probe
Change the initialization sequence to avoid overwriting the
variables with default values in eeprom i2c probe sequence.
Change-Id: I50b6e8164f556012f949d7be82dc450e156930cd
Signed-off-by: Ravi Kishore Tanuku <rktanuku@codeaurora.org>
diff --git a/drivers/media/platform/msm/camera/cam_sensor_module/cam_eeprom/cam_eeprom_dev.c b/drivers/media/platform/msm/camera/cam_sensor_module/cam_eeprom/cam_eeprom_dev.c
index 68c5eea..b8c32d4 100644
--- a/drivers/media/platform/msm/camera/cam_sensor_module/cam_eeprom/cam_eeprom_dev.c
+++ b/drivers/media/platform/msm/camera/cam_sensor_module/cam_eeprom/cam_eeprom_dev.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2017, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
@@ -69,6 +69,9 @@
cci_client->retries = 3;
cci_client->id_map = 0;
cci_client->i2c_freq_mode = i2c_info->i2c_freq_mode;
+ } else if (e_ctrl->io_master_info.master_type == I2C_MASTER) {
+ e_ctrl->io_master_info.client->addr = i2c_info->slave_addr;
+ CAM_DBG(CAM_EEPROM, "Slave addr: 0x%x", i2c_info->slave_addr);
}
return 0;
}
@@ -188,6 +191,9 @@
e_ctrl->io_master_info.master_type = I2C_MASTER;
e_ctrl->io_master_info.client = client;
e_ctrl->eeprom_device_type = MSM_CAMERA_I2C_DEVICE;
+ e_ctrl->cal_data.mapdata = NULL;
+ e_ctrl->cal_data.map = NULL;
+ e_ctrl->userspace_probe = false;
rc = cam_eeprom_parse_dt(e_ctrl);
if (rc) {
@@ -205,10 +211,6 @@
if (rc)
goto free_soc;
- e_ctrl->cal_data.mapdata = NULL;
- e_ctrl->cal_data.map = NULL;
- e_ctrl->userspace_probe = false;
-
if (soc_private->i2c_info.slave_addr != 0)
e_ctrl->io_master_info.client->addr =
soc_private->i2c_info.slave_addr;