diff mbox

mmc: sdhci-of-at91: fix pm runtime unbalanced issue in error path

Message ID 1453804954-3490-1-git-send-email-jszhang@marvell.com (mailing list archive)
State New, archived
Headers show

Commit Message

Jisheng Zhang Jan. 26, 2016, 10:42 a.m. UTC
The device power usage counter is increased by pm_runtime_get_noresume
but isn't decreased in err_add_host error path.

Fix this issue by calling pm_runtime_put_noidle() in the error path to
restore the device's power usage counter.

Signed-off-by: Jisheng Zhang <jszhang@marvell.com>
Fixes: f5f17813ae9b ("mmc: sdhci-of-at91: add PM support)
---
 drivers/mmc/host/sdhci-of-at91.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Ludovic Desroches Jan. 27, 2016, 4:17 p.m. UTC | #1
On Tue, Jan 26, 2016 at 06:42:34PM +0800, Jisheng Zhang wrote:
> The device power usage counter is increased by pm_runtime_get_noresume
> but isn't decreased in err_add_host error path.
> 
> Fix this issue by calling pm_runtime_put_noidle() in the error path to
> restore the device's power usage counter.
> 

Well spotted, thanks.

> Signed-off-by: Jisheng Zhang <jszhang@marvell.com>

Acked-by: Ludovic Desroches <ludovic.desroches@atmel.com>

> Fixes: f5f17813ae9b ("mmc: sdhci-of-at91: add PM support)
> ---
>  drivers/mmc/host/sdhci-of-at91.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/mmc/host/sdhci-of-at91.c b/drivers/mmc/host/sdhci-of-at91.c
> index 7db7163..3bf6f31 100644
> --- a/drivers/mmc/host/sdhci-of-at91.c
> +++ b/drivers/mmc/host/sdhci-of-at91.c
> @@ -210,7 +210,7 @@ static int sdhci_at91_probe(struct platform_device *pdev)
>  
>  pm_runtime_disable:
>  	pm_runtime_disable(&pdev->dev);
> -	pm_runtime_set_suspended(&pdev->dev);
> +	pm_runtime_put_noidle(&pdev->dev);
>  clocks_disable_unprepare:
>  	clk_disable_unprepare(priv->gck);
>  	clk_disable_unprepare(priv->mainck);
> -- 
> 2.7.0
>
Ulf Hansson Feb. 2, 2016, 11:32 a.m. UTC | #2
On 26 January 2016 at 11:42, Jisheng Zhang <jszhang@marvell.com> wrote:
> The device power usage counter is increased by pm_runtime_get_noresume
> but isn't decreased in err_add_host error path.
>
> Fix this issue by calling pm_runtime_put_noidle() in the error path to
> restore the device's power usage counter.
>
> Signed-off-by: Jisheng Zhang <jszhang@marvell.com>
> Fixes: f5f17813ae9b ("mmc: sdhci-of-at91: add PM support)
> ---
>  drivers/mmc/host/sdhci-of-at91.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/mmc/host/sdhci-of-at91.c b/drivers/mmc/host/sdhci-of-at91.c
> index 7db7163..3bf6f31 100644
> --- a/drivers/mmc/host/sdhci-of-at91.c
> +++ b/drivers/mmc/host/sdhci-of-at91.c
> @@ -210,7 +210,7 @@ static int sdhci_at91_probe(struct platform_device *pdev)
>
>  pm_runtime_disable:
>         pm_runtime_disable(&pdev->dev);
> -       pm_runtime_set_suspended(&pdev->dev);

What's the reason you want to remove the call to
pm_runtime_set_suspended()? I think it could stay.

> +       pm_runtime_put_noidle(&pdev->dev);
>  clocks_disable_unprepare:
>         clk_disable_unprepare(priv->gck);
>         clk_disable_unprepare(priv->mainck);
> --
> 2.7.0
>

Kind regards
Uffe
Jisheng Zhang Feb. 2, 2016, 11:39 a.m. UTC | #3
On Tue, 2 Feb 2016 12:32:29 +0100 Ulf Hansson wrote:

> On 26 January 2016 at 11:42, Jisheng Zhang <jszhang@marvell.com> wrote:
> > The device power usage counter is increased by pm_runtime_get_noresume
> > but isn't decreased in err_add_host error path.
> >
> > Fix this issue by calling pm_runtime_put_noidle() in the error path to
> > restore the device's power usage counter.
> >
> > Signed-off-by: Jisheng Zhang <jszhang@marvell.com>
> > Fixes: f5f17813ae9b ("mmc: sdhci-of-at91: add PM support)
> > ---
> >  drivers/mmc/host/sdhci-of-at91.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/mmc/host/sdhci-of-at91.c b/drivers/mmc/host/sdhci-of-at91.c
> > index 7db7163..3bf6f31 100644
> > --- a/drivers/mmc/host/sdhci-of-at91.c
> > +++ b/drivers/mmc/host/sdhci-of-at91.c
> > @@ -210,7 +210,7 @@ static int sdhci_at91_probe(struct platform_device *pdev)
> >
> >  pm_runtime_disable:
> >         pm_runtime_disable(&pdev->dev);
> > -       pm_runtime_set_suspended(&pdev->dev);  
> 
> What's the reason you want to remove the call to
> pm_runtime_set_suspended()? I think it could stay.

Indeed, thanks for pointing out. Will send a v2.

Thank you,
Jisheng

> 
> > +       pm_runtime_put_noidle(&pdev->dev);
> >  clocks_disable_unprepare:
> >         clk_disable_unprepare(priv->gck);
> >         clk_disable_unprepare(priv->mainck);
> > --
> > 2.7.0
> >  
> 
> Kind regards
> Uffe
diff mbox

Patch

diff --git a/drivers/mmc/host/sdhci-of-at91.c b/drivers/mmc/host/sdhci-of-at91.c
index 7db7163..3bf6f31 100644
--- a/drivers/mmc/host/sdhci-of-at91.c
+++ b/drivers/mmc/host/sdhci-of-at91.c
@@ -210,7 +210,7 @@  static int sdhci_at91_probe(struct platform_device *pdev)
 
 pm_runtime_disable:
 	pm_runtime_disable(&pdev->dev);
-	pm_runtime_set_suspended(&pdev->dev);
+	pm_runtime_put_noidle(&pdev->dev);
 clocks_disable_unprepare:
 	clk_disable_unprepare(priv->gck);
 	clk_disable_unprepare(priv->mainck);