UPSTREAM: regulator: core: avoid unused variable warning
[firefly-linux-kernel-4.4.55.git] / drivers / regulator / core.c
index 73b7683355cd015791114249defc26fdf2b644cf..c70017d5f74bb2d1305eb5d3f35a2885fbf9b51f 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);
 }
 
 /**