diff mbox series

[v2,19/35] mmc: sdhci-of-at91: Drop the use of sdhci_pltfm_free()

Message ID a1f998ecdae85cc3039cfa30096220d822b616fa.1748515612.git.zhoubinbin@loongson.cn
State Superseded
Headers show
Series mmc: Cleanup sdhci_pltfm_free()/sdhci_free_host() usage | expand

Commit Message

Binbin Zhou May 29, 2025, 1 p.m. UTC
Since the devm_mmc_alloc_host() helper is already in use,
sdhci_pltfm_free() is no longer needed.

Cc: Aubin Constans <aubin.constans@microchip.com>
Cc: Eugen Hristev <eugen.hristev@linaro.org>
Cc: Nicolas Ferre <nicolas.ferre@microchip.com>
Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>
Cc: Claudiu Beznea <claudiu.beznea@tuxon.dev>
Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
---
 drivers/mmc/host/sdhci-of-at91.c | 23 ++++++++---------------
 1 file changed, 8 insertions(+), 15 deletions(-)

Comments

Aubin Constans June 2, 2025, 4:09 p.m. UTC | #1
Hi Binbin,

Thank you for the change.

On 29/05/2025 15:00, Binbin Zhou wrote:
> Since the devm_mmc_alloc_host() helper is already in use,
> sdhci_pltfm_free() is no longer needed.
> 
> Cc: Aubin Constans <aubin.constans@microchip.com>
> Cc: Eugen Hristev <eugen.hristev@linaro.org>
> Cc: Nicolas Ferre <nicolas.ferre@microchip.com>
> Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>
> Cc: Claudiu Beznea <claudiu.beznea@tuxon.dev>
> Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
> ---
>   drivers/mmc/host/sdhci-of-at91.c | 23 ++++++++---------------
>   1 file changed, 8 insertions(+), 15 deletions(-)
> 
> diff --git a/drivers/mmc/host/sdhci-of-at91.c b/drivers/mmc/host/sdhci-of-at91.c
> index 97988ed37467..0b7d7db79139 100644
> --- a/drivers/mmc/host/sdhci-of-at91.c
> +++ b/drivers/mmc/host/sdhci-of-at91.c
> @@ -337,28 +337,23 @@ static int sdhci_at91_probe(struct platform_device *pdev)
>                          priv->mainck = NULL;
>                  } else {
>                          dev_err(&pdev->dev, "failed to get baseclk\n");
> -                       ret = PTR_ERR(priv->mainck);
> -                       goto sdhci_pltfm_free;
> +                       return PTR_ERR(priv->mainck);
>                  }
>          }

For consistency with the changes below, please use dev_err_probe() as well.
Doing so, you can remove the brackets in both if/else blocks. Or preserve these
brackets may you wish to keep the changes minimal.

Regards
Aubin

> 
>          priv->hclock = devm_clk_get(&pdev->dev, "hclock");
> -       if (IS_ERR(priv->hclock)) {
> -               dev_err(&pdev->dev, "failed to get hclock\n");
> -               ret = PTR_ERR(priv->hclock);
> -               goto sdhci_pltfm_free;
> -       }
> +       if (IS_ERR(priv->hclock))
> +               return dev_err_probe(&pdev->dev, PTR_ERR(priv->hclock),
> +                                    "failed to get hclock\n");
> 
>          priv->gck = devm_clk_get(&pdev->dev, "multclk");
> -       if (IS_ERR(priv->gck)) {
> -               dev_err(&pdev->dev, "failed to get multclk\n");
> -               ret = PTR_ERR(priv->gck);
> -               goto sdhci_pltfm_free;
> -       }
> +       if (IS_ERR(priv->gck))
> +               return dev_err_probe(&pdev->dev, PTR_ERR(priv->gck),
> +                                    "failed to get multclk\n");
> 
>          ret = sdhci_at91_set_clks_presets(&pdev->dev);
>          if (ret)
> -               goto sdhci_pltfm_free;
> +               return ret;
> 
>          priv->restore_needed = false;
> 
> @@ -438,8 +433,6 @@ static int sdhci_at91_probe(struct platform_device *pdev)
>          clk_disable_unprepare(priv->gck);
>          clk_disable_unprepare(priv->mainck);
>          clk_disable_unprepare(priv->hclock);
> -sdhci_pltfm_free:
> -       sdhci_pltfm_free(pdev);
>          return ret;
>   }
> 
> --
> 2.47.1
>
Binbin Zhou June 3, 2025, 7:25 a.m. UTC | #2
Hi Aubin:

Thanks for your reply.

On Tue, Jun 3, 2025 at 12:09 AM Aubin Constans
<aubin.constans@microchip.com> wrote:
>
> Hi Binbin,
>
> Thank you for the change.
>
> On 29/05/2025 15:00, Binbin Zhou wrote:
> > Since the devm_mmc_alloc_host() helper is already in use,
> > sdhci_pltfm_free() is no longer needed.
> >
> > Cc: Aubin Constans <aubin.constans@microchip.com>
> > Cc: Eugen Hristev <eugen.hristev@linaro.org>
> > Cc: Nicolas Ferre <nicolas.ferre@microchip.com>
> > Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>
> > Cc: Claudiu Beznea <claudiu.beznea@tuxon.dev>
> > Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
> > ---
> >   drivers/mmc/host/sdhci-of-at91.c | 23 ++++++++---------------
> >   1 file changed, 8 insertions(+), 15 deletions(-)
> >
> > diff --git a/drivers/mmc/host/sdhci-of-at91.c b/drivers/mmc/host/sdhci-of-at91.c
> > index 97988ed37467..0b7d7db79139 100644
> > --- a/drivers/mmc/host/sdhci-of-at91.c
> > +++ b/drivers/mmc/host/sdhci-of-at91.c
> > @@ -337,28 +337,23 @@ static int sdhci_at91_probe(struct platform_device *pdev)
> >                          priv->mainck = NULL;
> >                  } else {
> >                          dev_err(&pdev->dev, "failed to get baseclk\n");
> > -                       ret = PTR_ERR(priv->mainck);
> > -                       goto sdhci_pltfm_free;
> > +                       return PTR_ERR(priv->mainck);
> >                  }
> >          }
>
> For consistency with the changes below, please use dev_err_probe() as well.
> Doing so, you can remove the brackets in both if/else blocks. Or preserve these
> brackets may you wish to keep the changes minimal.

I will use dev_err_probe() to cleanup the code.
>
> Regards
> Aubin
>
> >
> >          priv->hclock = devm_clk_get(&pdev->dev, "hclock");
> > -       if (IS_ERR(priv->hclock)) {
> > -               dev_err(&pdev->dev, "failed to get hclock\n");
> > -               ret = PTR_ERR(priv->hclock);
> > -               goto sdhci_pltfm_free;
> > -       }
> > +       if (IS_ERR(priv->hclock))
> > +               return dev_err_probe(&pdev->dev, PTR_ERR(priv->hclock),
> > +                                    "failed to get hclock\n");
> >
> >          priv->gck = devm_clk_get(&pdev->dev, "multclk");
> > -       if (IS_ERR(priv->gck)) {
> > -               dev_err(&pdev->dev, "failed to get multclk\n");
> > -               ret = PTR_ERR(priv->gck);
> > -               goto sdhci_pltfm_free;
> > -       }
> > +       if (IS_ERR(priv->gck))
> > +               return dev_err_probe(&pdev->dev, PTR_ERR(priv->gck),
> > +                                    "failed to get multclk\n");
> >
> >          ret = sdhci_at91_set_clks_presets(&pdev->dev);
> >          if (ret)
> > -               goto sdhci_pltfm_free;
> > +               return ret;
> >
> >          priv->restore_needed = false;
> >
> > @@ -438,8 +433,6 @@ static int sdhci_at91_probe(struct platform_device *pdev)
> >          clk_disable_unprepare(priv->gck);
> >          clk_disable_unprepare(priv->mainck);
> >          clk_disable_unprepare(priv->hclock);
> > -sdhci_pltfm_free:
> > -       sdhci_pltfm_free(pdev);
> >          return ret;
> >   }
> >
> > --
> > 2.47.1
> >
>
diff mbox series

Patch

diff --git a/drivers/mmc/host/sdhci-of-at91.c b/drivers/mmc/host/sdhci-of-at91.c
index 97988ed37467..0b7d7db79139 100644
--- a/drivers/mmc/host/sdhci-of-at91.c
+++ b/drivers/mmc/host/sdhci-of-at91.c
@@ -337,28 +337,23 @@  static int sdhci_at91_probe(struct platform_device *pdev)
 			priv->mainck = NULL;
 		} else {
 			dev_err(&pdev->dev, "failed to get baseclk\n");
-			ret = PTR_ERR(priv->mainck);
-			goto sdhci_pltfm_free;
+			return PTR_ERR(priv->mainck);
 		}
 	}
 
 	priv->hclock = devm_clk_get(&pdev->dev, "hclock");
-	if (IS_ERR(priv->hclock)) {
-		dev_err(&pdev->dev, "failed to get hclock\n");
-		ret = PTR_ERR(priv->hclock);
-		goto sdhci_pltfm_free;
-	}
+	if (IS_ERR(priv->hclock))
+		return dev_err_probe(&pdev->dev, PTR_ERR(priv->hclock),
+				     "failed to get hclock\n");
 
 	priv->gck = devm_clk_get(&pdev->dev, "multclk");
-	if (IS_ERR(priv->gck)) {
-		dev_err(&pdev->dev, "failed to get multclk\n");
-		ret = PTR_ERR(priv->gck);
-		goto sdhci_pltfm_free;
-	}
+	if (IS_ERR(priv->gck))
+		return dev_err_probe(&pdev->dev, PTR_ERR(priv->gck),
+				     "failed to get multclk\n");
 
 	ret = sdhci_at91_set_clks_presets(&pdev->dev);
 	if (ret)
-		goto sdhci_pltfm_free;
+		return ret;
 
 	priv->restore_needed = false;
 
@@ -438,8 +433,6 @@  static int sdhci_at91_probe(struct platform_device *pdev)
 	clk_disable_unprepare(priv->gck);
 	clk_disable_unprepare(priv->mainck);
 	clk_disable_unprepare(priv->hclock);
-sdhci_pltfm_free:
-	sdhci_pltfm_free(pdev);
 	return ret;
 }