diff mbox

[V2,2/3] mfd: wm8994-core: disable regulators before removing them

Message ID 1ea4eed2967fd566fe0aa4a9f7a4d55083618445.1473996370.git.viresh.kumar@linaro.org
State New
Headers show

Commit Message

Viresh Kumar Sept. 16, 2016, 3:26 a.m. UTC
The order in which resources were freed in wm8994_device_exit() isn't
correct. The regulators are removed before they are disabled.

Fix it by reordering code a bit, which makes it exact opposite of
wm8994_device_init() as well.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>

Acked-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>


---
V1->V2:
- Added Ack from Charles.
---
 drivers/mfd/wm8994-core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

-- 
2.7.1.410.g6faf27b

Comments

Lee Jones Oct. 26, 2016, 12:22 p.m. UTC | #1
On Fri, 16 Sep 2016, Viresh Kumar wrote:

> The order in which resources were freed in wm8994_device_exit() isn't

> correct. The regulators are removed before they are disabled.

> 

> Fix it by reordering code a bit, which makes it exact opposite of

> wm8994_device_init() as well.

> 

> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>

> Acked-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>

> 

> ---

> V1->V2:

> - Added Ack from Charles.

> ---

>  drivers/mfd/wm8994-core.c | 2 +-

>  1 file changed, 1 insertion(+), 1 deletion(-)


Applied, thanks.

> diff --git a/drivers/mfd/wm8994-core.c b/drivers/mfd/wm8994-core.c

> index 1990b2c90732..95e6bc55adbb 100644

> --- a/drivers/mfd/wm8994-core.c

> +++ b/drivers/mfd/wm8994-core.c

> @@ -603,9 +603,9 @@ static int wm8994_device_init(struct wm8994 *wm8994, int irq)

>  static void wm8994_device_exit(struct wm8994 *wm8994)

>  {

>  	pm_runtime_disable(wm8994->dev);

> -	mfd_remove_devices(wm8994->dev);

>  	wm8994_irq_exit(wm8994);

>  	regulator_bulk_disable(wm8994->num_supplies, wm8994->supplies);

> +	mfd_remove_devices(wm8994->dev);

>  }

>  

>  static const struct of_device_id wm8994_of_match[] = {


-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
diff mbox

Patch

diff --git a/drivers/mfd/wm8994-core.c b/drivers/mfd/wm8994-core.c
index 1990b2c90732..95e6bc55adbb 100644
--- a/drivers/mfd/wm8994-core.c
+++ b/drivers/mfd/wm8994-core.c
@@ -603,9 +603,9 @@  static int wm8994_device_init(struct wm8994 *wm8994, int irq)
 static void wm8994_device_exit(struct wm8994 *wm8994)
 {
 	pm_runtime_disable(wm8994->dev);
-	mfd_remove_devices(wm8994->dev);
 	wm8994_irq_exit(wm8994);
 	regulator_bulk_disable(wm8994->num_supplies, wm8994->supplies);
+	mfd_remove_devices(wm8994->dev);
 }
 
 static const struct of_device_id wm8994_of_match[] = {