From: Mark Brown Date: Mon, 8 Jul 2013 08:14:45 +0000 (+0100) Subject: regulator: core: Drop references on supply regulator when unregistering X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=891636ea27ef42d92a420185d2ccbe190ba00a23;p=linux-beck.git regulator: core: Drop references on supply regulator when unregistering Signed-off-by: Mark Brown --- diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index 288c75abc190..1510333bcf0d 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -3740,8 +3740,11 @@ void regulator_unregister(struct regulator_dev *rdev) if (rdev == NULL) return; - if (rdev->supply) + if (rdev->supply) { + while (rdev->use_count--) + regulator_disable(rdev->supply); regulator_put(rdev->supply); + } mutex_lock(®ulator_list_mutex); debugfs_remove_recursive(rdev->debugfs); flush_work(&rdev->disable_work.work);