[PATCH] regulator: core: Fix locking of GPIO list on free
From: Mark Brown
Date: Tue Apr 12 2016 - 03:05:43 EST
When we acquire a shareable enable GPIO on probe we do so with the
regulator_list_mutex held. However when we release the GPIOs we do this
immediately after dropping the mutex meaning that the list could become
corrupted. Move the release into the locked region to avoid this.
Signed-off-by: Mark Brown <broonie@xxxxxxxxxx>
---
drivers/regulator/core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 1cff11205642..e414c24b2906 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -4021,8 +4021,8 @@ void regulator_unregister(struct regulator_dev *rdev)
WARN_ON(rdev->open_count);
unset_regulator_supplies(rdev);
list_del(&rdev->list);
- mutex_unlock(®ulator_list_mutex);
regulator_ena_gpio_free(rdev);
+ mutex_unlock(®ulator_list_mutex);
device_unregister(&rdev->dev);
}
EXPORT_SYMBOL_GPL(regulator_unregister);
--
2.8.0.rc3