diff mbox series

[v10,1/2] mmc : sdhci-of-dwcmshc : add error handling in dwcmshc_resume

Message ID 20230822195929.168552-1-limings@nvidia.com
State New
Headers show
Series [v10,1/2] mmc : sdhci-of-dwcmshc : add error handling in dwcmshc_resume | expand

Commit Message

Liming Sun Aug. 22, 2023, 7:59 p.m. UTC
This commit adds handling in dwcmshc_resume() for different error
cases.

Signed-off-by: Liming Sun <limings@nvidia.com>
---
 drivers/mmc/host/sdhci-of-dwcmshc.c | 21 ++++++++++++++++++---
 1 file changed, 18 insertions(+), 3 deletions(-)

Comments

Adrian Hunter Aug. 24, 2023, 7:25 a.m. UTC | #1
On 22/08/23 22:59, Liming Sun wrote:
> This commit adds handling in dwcmshc_resume() for different error
> cases.
> 
> Signed-off-by: Liming Sun <limings@nvidia.com>

We don't put a space before ":" in the subject line, and usually
capitalize after that i.e.

mmc: sdhci-of-dwcmshc: Add error handling in dwcmshc_resume()

Otherwise:

Acked-by: Adrian Hunter <adrian.hunter@intel.com>


> ---
>  drivers/mmc/host/sdhci-of-dwcmshc.c | 21 ++++++++++++++++++---
>  1 file changed, 18 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/mmc/host/sdhci-of-dwcmshc.c b/drivers/mmc/host/sdhci-of-dwcmshc.c
> index 31c1892f4ecd..bc332a035032 100644
> --- a/drivers/mmc/host/sdhci-of-dwcmshc.c
> +++ b/drivers/mmc/host/sdhci-of-dwcmshc.c
> @@ -630,17 +630,32 @@ static int dwcmshc_resume(struct device *dev)
>  	if (!IS_ERR(priv->bus_clk)) {
>  		ret = clk_prepare_enable(priv->bus_clk);
>  		if (ret)
> -			return ret;
> +			goto disable_clk;
>  	}
>  
>  	if (rk_priv) {
>  		ret = clk_bulk_prepare_enable(RK35xx_MAX_CLKS,
>  					      rk_priv->rockchip_clks);
>  		if (ret)
> -			return ret;
> +			goto disable_bus_clk;
>  	}
>  
> -	return sdhci_resume_host(host);
> +	ret = sdhci_resume_host(host);
> +	if (ret)
> +		goto disable_rockchip_clks;
> +
> +	return 0;
> +
> +disable_rockchip_clks:
> +	if (rk_priv)
> +		clk_bulk_disable_unprepare(RK35xx_MAX_CLKS,
> +					   rk_priv->rockchip_clks);
> +disable_bus_clk:
> +	if (!IS_ERR(priv->bus_clk))
> +		clk_disable_unprepare(priv->bus_clk);
> +disable_clk:
> +	clk_disable_unprepare(pltfm_host->clk);
> +	return ret;
>  }
>  #endif
>
Ulf Hansson Aug. 24, 2023, 11 a.m. UTC | #2
On Tue, 22 Aug 2023 at 21:59, Liming Sun <limings@nvidia.com> wrote:
>
> This commit adds handling in dwcmshc_resume() for different error
> cases.
>
> Signed-off-by: Liming Sun <limings@nvidia.com>

Applied for next (I amended the patch according to Adrian's
suggestions), thanks!

Kind regards
Uffe


> ---
>  drivers/mmc/host/sdhci-of-dwcmshc.c | 21 ++++++++++++++++++---
>  1 file changed, 18 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/mmc/host/sdhci-of-dwcmshc.c b/drivers/mmc/host/sdhci-of-dwcmshc.c
> index 31c1892f4ecd..bc332a035032 100644
> --- a/drivers/mmc/host/sdhci-of-dwcmshc.c
> +++ b/drivers/mmc/host/sdhci-of-dwcmshc.c
> @@ -630,17 +630,32 @@ static int dwcmshc_resume(struct device *dev)
>         if (!IS_ERR(priv->bus_clk)) {
>                 ret = clk_prepare_enable(priv->bus_clk);
>                 if (ret)
> -                       return ret;
> +                       goto disable_clk;
>         }
>
>         if (rk_priv) {
>                 ret = clk_bulk_prepare_enable(RK35xx_MAX_CLKS,
>                                               rk_priv->rockchip_clks);
>                 if (ret)
> -                       return ret;
> +                       goto disable_bus_clk;
>         }
>
> -       return sdhci_resume_host(host);
> +       ret = sdhci_resume_host(host);
> +       if (ret)
> +               goto disable_rockchip_clks;
> +
> +       return 0;
> +
> +disable_rockchip_clks:
> +       if (rk_priv)
> +               clk_bulk_disable_unprepare(RK35xx_MAX_CLKS,
> +                                          rk_priv->rockchip_clks);
> +disable_bus_clk:
> +       if (!IS_ERR(priv->bus_clk))
> +               clk_disable_unprepare(priv->bus_clk);
> +disable_clk:
> +       clk_disable_unprepare(pltfm_host->clk);
> +       return ret;
>  }
>  #endif
>
> --
> 2.30.1
>
diff mbox series

Patch

diff --git a/drivers/mmc/host/sdhci-of-dwcmshc.c b/drivers/mmc/host/sdhci-of-dwcmshc.c
index 31c1892f4ecd..bc332a035032 100644
--- a/drivers/mmc/host/sdhci-of-dwcmshc.c
+++ b/drivers/mmc/host/sdhci-of-dwcmshc.c
@@ -630,17 +630,32 @@  static int dwcmshc_resume(struct device *dev)
 	if (!IS_ERR(priv->bus_clk)) {
 		ret = clk_prepare_enable(priv->bus_clk);
 		if (ret)
-			return ret;
+			goto disable_clk;
 	}
 
 	if (rk_priv) {
 		ret = clk_bulk_prepare_enable(RK35xx_MAX_CLKS,
 					      rk_priv->rockchip_clks);
 		if (ret)
-			return ret;
+			goto disable_bus_clk;
 	}
 
-	return sdhci_resume_host(host);
+	ret = sdhci_resume_host(host);
+	if (ret)
+		goto disable_rockchip_clks;
+
+	return 0;
+
+disable_rockchip_clks:
+	if (rk_priv)
+		clk_bulk_disable_unprepare(RK35xx_MAX_CLKS,
+					   rk_priv->rockchip_clks);
+disable_bus_clk:
+	if (!IS_ERR(priv->bus_clk))
+		clk_disable_unprepare(priv->bus_clk);
+disable_clk:
+	clk_disable_unprepare(pltfm_host->clk);
+	return ret;
 }
 #endif