summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorJihoon Bang <jbang@nvidia.com>2011-09-30 17:22:55 -0700
committerRyan Wong <ryanw@nvidia.com>2011-10-04 16:37:01 -0700
commit504549c350bb66d43bf3aa46d91a68068c0f4b96 (patch)
tree9dad13c62ba71c86595ca15876889f909d2524aa /drivers
parent049c2acbee16cece35713ced63df28d18d617df5 (diff)
i2c: fix crash when there is no regulatortegra-12r10-android-2.3
Calling regulator_disable causes system to crash when there is no regualtor. It calls regulator_disable only when regulators exist. Bug 871860 Change-Id: I7b714ed2423721d47ebae708dd453600cbf42312 Reviewed-on: http://git-master/r/56078 Reviewed-by: Jihoon Bang <jbang@nvidia.com> Tested-by: Jihoon Bang <jbang@nvidia.com> Reviewed-by: Ryan Wong <ryanw@nvidia.com> Tested-by: Ryan Wong <ryanw@nvidia.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/i2c/muxes/pca954x.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/drivers/i2c/muxes/pca954x.c b/drivers/i2c/muxes/pca954x.c
index 34b253592cd0..5a80d6725bc0 100644
--- a/drivers/i2c/muxes/pca954x.c
+++ b/drivers/i2c/muxes/pca954x.c
@@ -274,8 +274,7 @@ static int __devinit pca954x_probe(struct i2c_client *client,
if (ret) {
dev_err(&client->dev, "%s: failed to enable vcc_i2c\n",
__func__);
- regulator_disable(data->vcc_reg);
- goto exit_regulator_put;
+ goto exit_vcc_regulator_disable;
}
}
@@ -290,9 +289,7 @@ static int __devinit pca954x_probe(struct i2c_client *client,
*/
if (i2c_smbus_read_byte(client) < 0) {
dev_warn(&client->dev, "probe failed\n");
- regulator_disable(data->vcc_reg);
- regulator_disable(data->i2c_reg);
- goto exit_regulator_put;
+ goto exit_regulator_disable;
}
/* Decrease ref count for pca954x vcc */
@@ -342,9 +339,15 @@ static int __devinit pca954x_probe(struct i2c_client *client,
virt_reg_failed:
for (num--; num >= 0; num--)
i2c_del_mux_adapter(data->virt_adaps[num]);
+exit_regulator_disable:
+ if (data->i2c_reg)
+ regulator_disable(data->i2c_reg);
+exit_vcc_regulator_disable:
+ if (data->vcc_reg)
+ regulator_disable(data->vcc_reg);
exit_regulator_put:
- regulator_put(data->vcc_reg);
regulator_put(data->i2c_reg);
+ regulator_put(data->vcc_reg);
exit_free:
kfree(data);
err: