From: Mark Brown Date: Tue, 12 Apr 2016 07:05:43 +0000 (+0100) Subject: UPSTREAM: regulator: core: Fix locking of GPIO list on free X-Git-Tag: firefly_0821_release~465 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=59ba6e0376c6cd680f9688648c680b8c642f325c;p=firefly-linux-kernel-4.4.55.git UPSTREAM: 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: Mark Brown (cherry picked from commit 2c0a303a128cbef54a7b58dc2e413b874d760097) Change-Id: I27a96e1b5ff3034fa068bda5436a479e01e5a61b Signed-off-by: David Wu --- diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index 9aa91fcc2d3e..9348c78e182a 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -4062,8 +4062,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);