Commit 2c0a303a authored by Mark Brown's avatar Mark Brown

regulator: core: Fix locking of GPIO list on free

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: default avatarMark Brown <broonie@kernel.org>
parent e437b900
...@@ -4021,8 +4021,8 @@ void regulator_unregister(struct regulator_dev *rdev) ...@@ -4021,8 +4021,8 @@ void regulator_unregister(struct regulator_dev *rdev)
WARN_ON(rdev->open_count); WARN_ON(rdev->open_count);
unset_regulator_supplies(rdev); unset_regulator_supplies(rdev);
list_del(&rdev->list); list_del(&rdev->list);
mutex_unlock(&regulator_list_mutex);
regulator_ena_gpio_free(rdev); regulator_ena_gpio_free(rdev);
mutex_unlock(&regulator_list_mutex);
device_unregister(&rdev->dev); device_unregister(&rdev->dev);
} }
EXPORT_SYMBOL_GPL(regulator_unregister); EXPORT_SYMBOL_GPL(regulator_unregister);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment