[v1,1/2] mmc: sdhci-pltfm: Drop unnecessary error messages in sdhci_pltfm_init()

Message ID 20231006105803.3374241-1-andriy.shevchenko@linux.intel.com
State New
Headers
Series [v1,1/2] mmc: sdhci-pltfm: Drop unnecessary error messages in sdhci_pltfm_init() |

Commit Message

Andy Shevchenko Oct. 6, 2023, 10:58 a.m. UTC
  The devm_platform_ioremap_resource() and platform_get_irq() print
the error messages themselves and our "failed" one brings no value
and just noise. Refactor code to avoid those noisy error messages.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/mmc/host/sdhci-pltfm.c | 22 +++++++---------------
 1 file changed, 7 insertions(+), 15 deletions(-)
  

Comments

Adrian Hunter Oct. 9, 2023, 4:35 p.m. UTC | #1
On 6/10/23 13:58, Andy Shevchenko wrote:
> The devm_platform_ioremap_resource() and platform_get_irq() print
> the error messages themselves and our "failed" one brings no value
> and just noise. Refactor code to avoid those noisy error messages.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

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

> ---
>  drivers/mmc/host/sdhci-pltfm.c | 22 +++++++---------------
>  1 file changed, 7 insertions(+), 15 deletions(-)
> 
> diff --git a/drivers/mmc/host/sdhci-pltfm.c b/drivers/mmc/host/sdhci-pltfm.c
> index a72e123a585d..4d1a703a5bdb 100644
> --- a/drivers/mmc/host/sdhci-pltfm.c
> +++ b/drivers/mmc/host/sdhci-pltfm.c
> @@ -115,26 +115,21 @@ struct sdhci_host *sdhci_pltfm_init(struct platform_device *pdev,
>  {
>  	struct sdhci_host *host;
>  	void __iomem *ioaddr;
> -	int irq, ret;
> +	int irq;
>  
>  	ioaddr = devm_platform_ioremap_resource(pdev, 0);
> -	if (IS_ERR(ioaddr)) {
> -		ret = PTR_ERR(ioaddr);
> -		goto err;
> -	}
> +	if (IS_ERR(ioaddr))
> +		return ERR_CAST(ioaddr);
>  
>  	irq = platform_get_irq(pdev, 0);
> -	if (irq < 0) {
> -		ret = irq;
> -		goto err;
> -	}
> +	if (irq < 0)
> +		return ERR_PTR(irq);
>  
>  	host = sdhci_alloc_host(&pdev->dev,
>  		sizeof(struct sdhci_pltfm_host) + priv_size);
> -
>  	if (IS_ERR(host)) {
> -		ret = PTR_ERR(host);
> -		goto err;
> +		dev_err(&pdev->dev, "%s failed %pe\n", __func__, host);
> +		return ERR_CAST(host);
>  	}
>  
>  	host->ioaddr = ioaddr;
> @@ -152,9 +147,6 @@ struct sdhci_host *sdhci_pltfm_init(struct platform_device *pdev,
>  	platform_set_drvdata(pdev, host);
>  
>  	return host;
> -err:
> -	dev_err(&pdev->dev, "%s failed %d\n", __func__, ret);
> -	return ERR_PTR(ret);
>  }
>  EXPORT_SYMBOL_GPL(sdhci_pltfm_init);
>
  
Ulf Hansson Oct. 10, 2023, 2:27 p.m. UTC | #2
On Fri, 6 Oct 2023 at 12:58, Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
>
> The devm_platform_ioremap_resource() and platform_get_irq() print
> the error messages themselves and our "failed" one brings no value
> and just noise. Refactor code to avoid those noisy error messages.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Applied for next, thanks!

Kind regards
Uffe


> ---
>  drivers/mmc/host/sdhci-pltfm.c | 22 +++++++---------------
>  1 file changed, 7 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/mmc/host/sdhci-pltfm.c b/drivers/mmc/host/sdhci-pltfm.c
> index a72e123a585d..4d1a703a5bdb 100644
> --- a/drivers/mmc/host/sdhci-pltfm.c
> +++ b/drivers/mmc/host/sdhci-pltfm.c
> @@ -115,26 +115,21 @@ struct sdhci_host *sdhci_pltfm_init(struct platform_device *pdev,
>  {
>         struct sdhci_host *host;
>         void __iomem *ioaddr;
> -       int irq, ret;
> +       int irq;
>
>         ioaddr = devm_platform_ioremap_resource(pdev, 0);
> -       if (IS_ERR(ioaddr)) {
> -               ret = PTR_ERR(ioaddr);
> -               goto err;
> -       }
> +       if (IS_ERR(ioaddr))
> +               return ERR_CAST(ioaddr);
>
>         irq = platform_get_irq(pdev, 0);
> -       if (irq < 0) {
> -               ret = irq;
> -               goto err;
> -       }
> +       if (irq < 0)
> +               return ERR_PTR(irq);
>
>         host = sdhci_alloc_host(&pdev->dev,
>                 sizeof(struct sdhci_pltfm_host) + priv_size);
> -
>         if (IS_ERR(host)) {
> -               ret = PTR_ERR(host);
> -               goto err;
> +               dev_err(&pdev->dev, "%s failed %pe\n", __func__, host);
> +               return ERR_CAST(host);
>         }
>
>         host->ioaddr = ioaddr;
> @@ -152,9 +147,6 @@ struct sdhci_host *sdhci_pltfm_init(struct platform_device *pdev,
>         platform_set_drvdata(pdev, host);
>
>         return host;
> -err:
> -       dev_err(&pdev->dev, "%s failed %d\n", __func__, ret);
> -       return ERR_PTR(ret);
>  }
>  EXPORT_SYMBOL_GPL(sdhci_pltfm_init);
>
> --
> 2.40.0.1.gaa8946217a0b
>
  

Patch

diff --git a/drivers/mmc/host/sdhci-pltfm.c b/drivers/mmc/host/sdhci-pltfm.c
index a72e123a585d..4d1a703a5bdb 100644
--- a/drivers/mmc/host/sdhci-pltfm.c
+++ b/drivers/mmc/host/sdhci-pltfm.c
@@ -115,26 +115,21 @@  struct sdhci_host *sdhci_pltfm_init(struct platform_device *pdev,
 {
 	struct sdhci_host *host;
 	void __iomem *ioaddr;
-	int irq, ret;
+	int irq;
 
 	ioaddr = devm_platform_ioremap_resource(pdev, 0);
-	if (IS_ERR(ioaddr)) {
-		ret = PTR_ERR(ioaddr);
-		goto err;
-	}
+	if (IS_ERR(ioaddr))
+		return ERR_CAST(ioaddr);
 
 	irq = platform_get_irq(pdev, 0);
-	if (irq < 0) {
-		ret = irq;
-		goto err;
-	}
+	if (irq < 0)
+		return ERR_PTR(irq);
 
 	host = sdhci_alloc_host(&pdev->dev,
 		sizeof(struct sdhci_pltfm_host) + priv_size);
-
 	if (IS_ERR(host)) {
-		ret = PTR_ERR(host);
-		goto err;
+		dev_err(&pdev->dev, "%s failed %pe\n", __func__, host);
+		return ERR_CAST(host);
 	}
 
 	host->ioaddr = ioaddr;
@@ -152,9 +147,6 @@  struct sdhci_host *sdhci_pltfm_init(struct platform_device *pdev,
 	platform_set_drvdata(pdev, host);
 
 	return host;
-err:
-	dev_err(&pdev->dev, "%s failed %d\n", __func__, ret);
-	return ERR_PTR(ret);
 }
 EXPORT_SYMBOL_GPL(sdhci_pltfm_init);