[PATCH] mmc: davinci_mmc: Handle error for clk_enable

Jiasheng Jiang posted 1 patch 4 years, 3 months ago
drivers/mmc/host/davinci_mmc.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
[PATCH] mmc: davinci_mmc: Handle error for clk_enable
Posted by Jiasheng Jiang 4 years, 3 months ago
As the potential failure of the clk_enable(),
it should be better to check it and return error
if fails.

Fixes: bbce5802afc5 ("davinci: mmc: updates to suspend/resume implementation")
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
---
 drivers/mmc/host/davinci_mmc.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/mmc/host/davinci_mmc.c b/drivers/mmc/host/davinci_mmc.c
index 2a757c88f9d2..80de660027d8 100644
--- a/drivers/mmc/host/davinci_mmc.c
+++ b/drivers/mmc/host/davinci_mmc.c
@@ -1375,8 +1375,12 @@ static int davinci_mmcsd_suspend(struct device *dev)
 static int davinci_mmcsd_resume(struct device *dev)
 {
 	struct mmc_davinci_host *host = dev_get_drvdata(dev);
+	int ret;
+
+	ret = clk_enable(host->clk);
+	if (ret)
+		return ret;
 
-	clk_enable(host->clk);
 	mmc_davinci_reset_ctrl(host, 0);
 
 	return 0;
-- 
2.25.1
Re: [PATCH] mmc: davinci_mmc: Handle error for clk_enable
Posted by Ulf Hansson 4 years, 3 months ago
On Tue, 8 Mar 2022 at 08:14, Jiasheng Jiang <jiasheng@iscas.ac.cn> wrote:
>
> As the potential failure of the clk_enable(),
> it should be better to check it and return error
> if fails.
>
> Fixes: bbce5802afc5 ("davinci: mmc: updates to suspend/resume implementation")
> Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>

Applied for next, thanks!

Kind regards
Uffe



> ---
>  drivers/mmc/host/davinci_mmc.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/mmc/host/davinci_mmc.c b/drivers/mmc/host/davinci_mmc.c
> index 2a757c88f9d2..80de660027d8 100644
> --- a/drivers/mmc/host/davinci_mmc.c
> +++ b/drivers/mmc/host/davinci_mmc.c
> @@ -1375,8 +1375,12 @@ static int davinci_mmcsd_suspend(struct device *dev)
>  static int davinci_mmcsd_resume(struct device *dev)
>  {
>         struct mmc_davinci_host *host = dev_get_drvdata(dev);
> +       int ret;
> +
> +       ret = clk_enable(host->clk);
> +       if (ret)
> +               return ret;
>
> -       clk_enable(host->clk);
>         mmc_davinci_reset_ctrl(host, 0);
>
>         return 0;
> --
> 2.25.1
>