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

Commit c778357d authored by Tanvi Aggarwal's avatar Tanvi Aggarwal Committed by Gerrit - the friendly Code Review server
Browse files

msm: camera: Fix KW issues in sensor code



Fixing issue where we are dereferencing a NULL pointer.
There is an issue where, if we have a failure in memory
allocation for a mutex, we are not updating rc but freeing
the allocated memory for i2c client. Hence this may lead
to NULL pointer dereference for i2c client at next stage.
Hence we are updating correct rc before freeing the i2c
client memory and returning back to parent function.

CRs-Fixed: 1066972
Change-Id: I7f9493344da2baddb88fd0db14b894fc242d9f9f
Signed-off-by: default avatarTanvi Aggarwal <tanvia@codeaurora.org>
parent 1299ca69
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -1117,6 +1117,7 @@ static int32_t msm_sensor_driver_parse(struct msm_sensor_ctrl_t *s_ctrl)
	if (!s_ctrl->msm_sensor_mutex) {
		pr_err("failed: no memory msm_sensor_mutex %pK",
			s_ctrl->msm_sensor_mutex);
		rc = -ENOMEM;
		goto FREE_SENSOR_I2C_CLIENT;
	}