aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/regulator/core.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 27d062e1395c..c577c6d344ac 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -1267,15 +1267,17 @@ static int _regulator_enable(struct regulator_dev *rdev)
1267{ 1267{
1268 int ret, delay; 1268 int ret, delay;
1269 1269
1270 /* do we need to enable the supply regulator first */ 1270 if (rdev->use_count == 0) {
1271 if (rdev->supply) { 1271 /* do we need to enable the supply regulator first */
1272 mutex_lock(&rdev->supply->mutex); 1272 if (rdev->supply) {
1273 ret = _regulator_enable(rdev->supply); 1273 mutex_lock(&rdev->supply->mutex);
1274 mutex_unlock(&rdev->supply->mutex); 1274 ret = _regulator_enable(rdev->supply);
1275 if (ret < 0) { 1275 mutex_unlock(&rdev->supply->mutex);
1276 printk(KERN_ERR "%s: failed to enable %s: %d\n", 1276 if (ret < 0) {
1277 __func__, rdev_get_name(rdev), ret); 1277 printk(KERN_ERR "%s: failed to enable %s: %d\n",
1278 return ret; 1278 __func__, rdev_get_name(rdev), ret);
1279 return ret;
1280 }
1279 } 1281 }
1280 } 1282 }
1281 1283