Merge remote-tracking branch 'regulator/fix/core' into regulator-linus
authorMark Brown <broonie@kernel.org>
Tue, 12 Jan 2016 18:26:02 +0000 (18:26 +0000)
committerMark Brown <broonie@kernel.org>
Tue, 12 Jan 2016 18:26:02 +0000 (18:26 +0000)
drivers/regulator/core.c

index 73b7683..c70017d 100644 (file)
@@ -138,18 +138,10 @@ static bool have_full_constraints(void)
  */
 static void regulator_lock_supply(struct regulator_dev *rdev)
 {
-       struct regulator *supply;
-       int i = 0;
-
-       while (1) {
-               mutex_lock_nested(&rdev->mutex, i++);
-               supply = rdev->supply;
-
-               if (!rdev->supply)
-                       return;
+       int i;
 
-               rdev = supply->rdev;
-       }
+       for (i = 0; rdev->supply; rdev = rdev->supply->rdev, i++)
+               mutex_lock_nested(&rdev->mutex, i);
 }
 
 /**