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

Commit 721967fc authored by Vasko Kalanoski's avatar Vasko Kalanoski Committed by Gerrit - the friendly Code Review server
Browse files

msm: camera: add free memory for ois_ctrl in case of error



add free memory for ois_ctrl_t in ois driver to prevent of
memory leak in error cases

Change-Id: Ibe61483ae39611263451b74658c5a187c5e756ae
Signed-off-by: default avatarVasko Kalanoski <vaskok@codeaurora.org>
parent 64590efd
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
/* Copyright (c) 2014, The Linux Foundation. All rights reserved.
/* Copyright (c) 2014 - 2015, 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
@@ -476,8 +476,7 @@ static int32_t msm_ois_i2c_probe(struct i2c_client *client,

	if (client == NULL) {
		pr_err("msm_ois_i2c_probe: client is null\n");
		rc = -EINVAL;
		goto probe_failure;
		return -EINVAL;
	}

	ois_ctrl_t = kzalloc(sizeof(struct msm_ois_ctrl_t),
@@ -489,6 +488,7 @@ static int32_t msm_ois_i2c_probe(struct i2c_client *client,

	if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
		pr_err("i2c_check_functionality failed\n");
		rc = -EINVAL;
		goto probe_failure;
	}

@@ -499,7 +499,7 @@ static int32_t msm_ois_i2c_probe(struct i2c_client *client,
	CDBG("cell-index %d, rc %d\n", ois_ctrl_t->subdev_id, rc);
	if (rc < 0) {
		pr_err("failed rc %d\n", rc);
		return rc;
		goto probe_failure;
	}

	ois_ctrl_t->i2c_driver = &msm_ois_i2c_driver;
@@ -531,6 +531,7 @@ static int32_t msm_ois_i2c_probe(struct i2c_client *client,
	CDBG("Exit\n");

probe_failure:
	kfree(ois_ctrl_t);
	return rc;
}