Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ba60c15e authored by Samyukta Mogily's avatar Samyukta Mogily
Browse files

msm: camera: Fixing NULL dereference in sensor code



Fixing issues where we are referring to a null pointer.

Change-Id: I6ae18f61a9dc65fbec5650baf9b1d1fb7ad59262
Signed-off-by: default avatarSamyukta Mogily <smogily@codeaurora.org>
parent f9aee28d
Loading
Loading
Loading
Loading
+11 −1
Original line number Diff line number Diff line
/* Copyright (c) 2011-2016, The Linux Foundation. All rights reserved.
/* Copyright (c) 2011-2017, 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
@@ -1269,6 +1269,11 @@ static int msm_eeprom_spi_remove(struct spi_device *sdev)
		return 0;
	}

	if (!e_ctrl->eboard_info) {
		pr_err("%s: board info is NULL\n", __func__);
		return 0;
	}

	msm_camera_i2c_dev_put_clk_info(
		&e_ctrl->i2c_client.spi_client->spi_master->dev,
		&e_ctrl->eboard_info->power_info.clk_info,
@@ -1788,6 +1793,11 @@ static int msm_eeprom_platform_remove(struct platform_device *pdev)
		return 0;
	}

	if (!e_ctrl->eboard_info) {
		pr_err("%s: board info is NULL\n", __func__);
		return 0;
	}

	msm_camera_put_clk_info(e_ctrl->pdev,
		&e_ctrl->eboard_info->power_info.clk_info,
		&e_ctrl->eboard_info->power_info.clk_ptr,
+14 −12
Original line number Diff line number Diff line
/* Copyright (c) 2013-2016, The Linux Foundation. All rights reserved.
/* Copyright (c) 2013-2017, 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
@@ -1341,7 +1341,7 @@ static int32_t msm_sensor_driver_i2c_probe(struct i2c_client *client,
	if (s_ctrl->sensor_i2c_client != NULL) {
		s_ctrl->sensor_i2c_client->client = client;
		s_ctrl->sensordata->power_info.dev = &client->dev;
	}

		/* Get clocks information */
		rc = msm_camera_i2c_dev_get_clk_info(
			&s_ctrl->sensor_i2c_client->client->dev,
@@ -1349,10 +1349,12 @@ static int32_t msm_sensor_driver_i2c_probe(struct i2c_client *client,
			&s_ctrl->sensordata->power_info.clk_ptr,
			&s_ctrl->sensordata->power_info.clk_info_size);
		if (rc < 0) {
		pr_err("failed: msm_camera_i2c_dev_get_clk_info rc %d", rc);
			pr_err("failed: msm_camera_i2c_dev_get_clk_info rc %d",
				rc);
			goto FREE_S_CTRL;
		}
		return rc;
	}
FREE_S_CTRL:
	kfree(s_ctrl);
	return rc;