1 From 49a6bb7a1c0963f260e4b0dcc2c0e56ec65a28b2 Mon Sep 17 00:00:00 2001
2 From: Mark Brown <broonie@kernel.org>
3 Date: Tue, 1 Dec 2015 15:51:52 +0000
4 Subject: regulator: core: Ensure we lock all regulators
6 From: Mark Brown <broonie@kernel.org>
8 commit 49a6bb7a1c0963f260e4b0dcc2c0e56ec65a28b2 upstream.
10 The latest workaround for the lockdep interface's not using the second
11 argument of mutex_lock_nested() changed the loop missed locking the last
12 regulator due to a thinko with the loop termination condition exiting
13 one regulator too soon.
15 Reported-by: Tyler Baker <tyler.baker@linaro.org>
16 Signed-off-by: Mark Brown <broonie@kernel.org>
17 Cc: Guenter Roeck <linux@roeck-us.net>
18 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
21 drivers/regulator/core.c | 2 +-
22 1 file changed, 1 insertion(+), 1 deletion(-)
24 --- a/drivers/regulator/core.c
25 +++ b/drivers/regulator/core.c
26 @@ -141,7 +141,7 @@ static void regulator_lock_supply(struct
29 mutex_lock(&rdev->mutex);
30 - for (i = 1; rdev->supply; rdev = rdev->supply->rdev, i++)
31 + for (i = 1; rdev; rdev = rdev->supply->rdev, i++)
32 mutex_lock_nested(&rdev->mutex, i);