提交 e032b376 编写于 作者: M Mark Brown

regulator: Fix deadlock on removal of regulators with supplies

If a regulator with a supply is being unregistered we will call
regulator_put() to release the supply with the regulator_list_mutex held
but this deadlocks as regulator_put() takes the same lock. Fix this by
releasing the supply before we take the mutex in regulator_unregister().
Signed-off-by: NMark Brown <broonie@opensource.wolfsonmicro.com>
上级 15c08f66
...@@ -2992,14 +2992,14 @@ void regulator_unregister(struct regulator_dev *rdev) ...@@ -2992,14 +2992,14 @@ void regulator_unregister(struct regulator_dev *rdev)
if (rdev == NULL) if (rdev == NULL)
return; return;
if (rdev->supply)
regulator_put(rdev->supply);
mutex_lock(&regulator_list_mutex); mutex_lock(&regulator_list_mutex);
debugfs_remove_recursive(rdev->debugfs); debugfs_remove_recursive(rdev->debugfs);
flush_work_sync(&rdev->disable_work.work); flush_work_sync(&rdev->disable_work.work);
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);
if (rdev->supply)
regulator_put(rdev->supply);
kfree(rdev->constraints); kfree(rdev->constraints);
device_unregister(&rdev->dev); device_unregister(&rdev->dev);
mutex_unlock(&regulator_list_mutex); mutex_unlock(&regulator_list_mutex);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册