msm: camera: common: Memory leak and unused variable fixes

Some dead code was removed and a memory leak issue was resolved
This solves issues related to VA_UNUSED.GEN and MLK.MIGHT.

CRs-Fixed: 3394193
Change-Id: I387587a3e359df9ad44a15e3e3f58b3422c81ad9
Signed-off-by: Atiya Kailany <quic_akailany@quicinc.com>
This commit is contained in:
Atiya Kailany
2023-01-27 19:23:43 -08:00
committed by Camera Software Integration
parent ef9248717e
commit faad1003f2
2 changed files with 14 additions and 15 deletions

View File

@@ -648,7 +648,6 @@ void cam_eeprom_spi_driver_remove(struct spi_device *sdev)
struct v4l2_subdev *sd = spi_get_drvdata(sdev); struct v4l2_subdev *sd = spi_get_drvdata(sdev);
struct cam_eeprom_ctrl_t *e_ctrl; struct cam_eeprom_ctrl_t *e_ctrl;
struct cam_eeprom_soc_private *soc_private; struct cam_eeprom_soc_private *soc_private;
struct cam_hw_soc_info *soc_info;
if (!sd) { if (!sd) {
CAM_ERR(CAM_EEPROM, "Subdevice is NULL"); CAM_ERR(CAM_EEPROM, "Subdevice is NULL");
@@ -661,7 +660,6 @@ void cam_eeprom_spi_driver_remove(struct spi_device *sdev)
return; return;
} }
soc_info = &e_ctrl->soc_info;
mutex_lock(&(e_ctrl->eeprom_mutex)); mutex_lock(&(e_ctrl->eeprom_mutex));
cam_eeprom_shutdown(e_ctrl); cam_eeprom_shutdown(e_ctrl);
mutex_unlock(&(e_ctrl->eeprom_mutex)); mutex_unlock(&(e_ctrl->eeprom_mutex));

View File

@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0-only // SPDX-License-Identifier: GPL-2.0-only
/* /*
* Copyright (c) 2015-2021, The Linux Foundation. All rights reserved. * Copyright (c) 2015-2021, The Linux Foundation. All rights reserved.
* Copyright (c) 2022, Qualcomm Innovation Center, Inc. All rights reserved. * Copyright (c) 2022-2023, Qualcomm Innovation Center, Inc. All rights reserved.
*/ */
#include <linux/of.h> #include <linux/of.h>
@@ -2084,8 +2084,10 @@ static int cam_soc_util_get_gpio_info(struct cam_hw_soc_info *soc_info)
CAM_DBG(CAM_UTIL, "gpio count %d", gpio_array_size); CAM_DBG(CAM_UTIL, "gpio count %d", gpio_array_size);
gpio_array = kcalloc(gpio_array_size, sizeof(uint16_t), GFP_KERNEL); gpio_array = kcalloc(gpio_array_size, sizeof(uint16_t), GFP_KERNEL);
if (!gpio_array) if (!gpio_array) {
goto free_gpio_conf; rc = -ENOMEM;
goto err;
}
for (i = 0; i < gpio_array_size; i++) { for (i = 0; i < gpio_array_size; i++) {
gpio_array[i] = of_get_gpio(of_node, i); gpio_array[i] = of_get_gpio(of_node, i);
@@ -2093,21 +2095,23 @@ static int cam_soc_util_get_gpio_info(struct cam_hw_soc_info *soc_info)
} }
gconf = kzalloc(sizeof(*gconf), GFP_KERNEL); gconf = kzalloc(sizeof(*gconf), GFP_KERNEL);
if (!gconf) if (!gconf) {
return -ENOMEM; rc = -ENOMEM;
goto free_gpio_array;
}
rc = cam_soc_util_get_dt_gpio_req_tbl(of_node, gconf, gpio_array, rc = cam_soc_util_get_dt_gpio_req_tbl(of_node, gconf, gpio_array,
gpio_array_size); gpio_array_size);
if (rc) { if (rc) {
CAM_ERR(CAM_UTIL, "failed in msm_camera_get_dt_gpio_req_tbl"); CAM_ERR(CAM_UTIL, "failed in msm_camera_get_dt_gpio_req_tbl");
goto free_gpio_array; goto free_gpio_conf;
} }
gconf->cam_gpio_common_tbl = kcalloc(gpio_array_size, gconf->cam_gpio_common_tbl = kcalloc(gpio_array_size,
sizeof(struct gpio), GFP_KERNEL); sizeof(struct gpio), GFP_KERNEL);
if (!gconf->cam_gpio_common_tbl) { if (!gconf->cam_gpio_common_tbl) {
rc = -ENOMEM; rc = -ENOMEM;
goto free_gpio_array; goto free_gpio_conf;
} }
for (i = 0; i < gpio_array_size; i++) for (i = 0; i < gpio_array_size; i++)
@@ -2119,12 +2123,12 @@ static int cam_soc_util_get_gpio_info(struct cam_hw_soc_info *soc_info)
return rc; return rc;
free_gpio_array:
kfree(gpio_array);
free_gpio_conf: free_gpio_conf:
kfree(gconf); kfree(gconf);
free_gpio_array:
kfree(gpio_array);
err:
soc_info->gpio_data = NULL; soc_info->gpio_data = NULL;
return rc; return rc;
} }
@@ -2197,7 +2201,6 @@ static int cam_soc_util_get_dt_regulator_info
if (count != -EINVAL) { if (count != -EINVAL) {
if (count <= 0) { if (count <= 0) {
CAM_ERR(CAM_UTIL, "no regulators found"); CAM_ERR(CAM_UTIL, "no regulators found");
count = 0;
return -EINVAL; return -EINVAL;
} }
@@ -2324,7 +2327,6 @@ int cam_soc_util_get_dt_properties(struct cam_hw_soc_info *soc_info)
if (rc) { if (rc) {
CAM_DBG(CAM_UTIL, "No interrupt line preset for: %s", CAM_DBG(CAM_UTIL, "No interrupt line preset for: %s",
soc_info->dev_name); soc_info->dev_name);
rc = 0;
} else { } else {
rc = cam_compat_util_get_irq(soc_info); rc = cam_compat_util_get_irq(soc_info);
if (rc < 0) { if (rc < 0) {
@@ -2348,7 +2350,6 @@ int cam_soc_util_get_dt_properties(struct cam_hw_soc_info *soc_info)
if (rc) { if (rc) {
CAM_DBG(CAM_UTIL, "No compatible string present for: %s", CAM_DBG(CAM_UTIL, "No compatible string present for: %s",
soc_info->dev_name); soc_info->dev_name);
rc = 0;
} }
soc_info->is_nrt_dev = false; soc_info->is_nrt_dev = false;