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: Tanvi Aggarwal <tanvia@codeaurora.org>
This commit is contained in:
Tanvi Aggarwal 2016-09-12 17:41:23 +05:30 committed by Gerrit - the friendly Code Review server
parent 9e2d528dc4
commit e2f82b3995

View file

@ -1167,6 +1167,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;
}