[PATCH] mmc: sunxi: Remove dev_err_probe() if error is -ENOMEM

Xichao Zhao posted 1 patch 1 month, 1 week ago
drivers/mmc/host/sunxi-mmc.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
[PATCH] mmc: sunxi: Remove dev_err_probe() if error is -ENOMEM
Posted by Xichao Zhao 1 month, 1 week ago
The dev_err_probe() doesn't do anything when error is '-ENOMEM'.
Therefore, remove the useless call to dev_err_probe(), and just
return the value instead.

Signed-off-by: Xichao Zhao <zhao.xichao@vivo.com>
---
 drivers/mmc/host/sunxi-mmc.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/mmc/host/sunxi-mmc.c b/drivers/mmc/host/sunxi-mmc.c
index ee4a65b0a22d..8dd1d2409a26 100644
--- a/drivers/mmc/host/sunxi-mmc.c
+++ b/drivers/mmc/host/sunxi-mmc.c
@@ -1371,8 +1371,8 @@ static int sunxi_mmc_probe(struct platform_device *pdev)
 
 	mmc = devm_mmc_alloc_host(&pdev->dev, sizeof(*host));
 	if (!mmc)
-		return dev_err_probe(&pdev->dev, -ENOMEM,
-				     "mmc alloc host failed\n");
+		return -ENOMEM;
+
 	platform_set_drvdata(pdev, mmc);
 
 	host = mmc_priv(mmc);
@@ -1387,8 +1387,7 @@ static int sunxi_mmc_probe(struct platform_device *pdev)
 	host->sg_cpu = dma_alloc_coherent(&pdev->dev, PAGE_SIZE,
 					  &host->sg_dma, GFP_KERNEL);
 	if (!host->sg_cpu)
-		return dev_err_probe(&pdev->dev, -ENOMEM,
-				     "Failed to allocate DMA descriptor mem\n");
+		return -ENOMEM;
 
 	if (host->cfg->ccu_has_timings_switch) {
 		/*
-- 
2.34.1
Re: [PATCH] mmc: sunxi: Remove dev_err_probe() if error is -ENOMEM
Posted by Jernej Škrabec 3 weeks, 4 days ago
Dne četrtek, 21. avgust 2025 ob 11:17:21 Srednjeevropski poletni čas je Xichao Zhao napisal(a):
> The dev_err_probe() doesn't do anything when error is '-ENOMEM'.
> Therefore, remove the useless call to dev_err_probe(), and just
> return the value instead.

It would be better to print error message rather than dismiss them.

Best regards,
Jernej

> 
> Signed-off-by: Xichao Zhao <zhao.xichao@vivo.com>
> ---
>  drivers/mmc/host/sunxi-mmc.c | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/mmc/host/sunxi-mmc.c b/drivers/mmc/host/sunxi-mmc.c
> index ee4a65b0a22d..8dd1d2409a26 100644
> --- a/drivers/mmc/host/sunxi-mmc.c
> +++ b/drivers/mmc/host/sunxi-mmc.c
> @@ -1371,8 +1371,8 @@ static int sunxi_mmc_probe(struct platform_device *pdev)
>  
>  	mmc = devm_mmc_alloc_host(&pdev->dev, sizeof(*host));
>  	if (!mmc)
> -		return dev_err_probe(&pdev->dev, -ENOMEM,
> -				     "mmc alloc host failed\n");
> +		return -ENOMEM;
> +
>  	platform_set_drvdata(pdev, mmc);
>  
>  	host = mmc_priv(mmc);
> @@ -1387,8 +1387,7 @@ static int sunxi_mmc_probe(struct platform_device *pdev)
>  	host->sg_cpu = dma_alloc_coherent(&pdev->dev, PAGE_SIZE,
>  					  &host->sg_dma, GFP_KERNEL);
>  	if (!host->sg_cpu)
> -		return dev_err_probe(&pdev->dev, -ENOMEM,
> -				     "Failed to allocate DMA descriptor mem\n");
> +		return -ENOMEM;
>  
>  	if (host->cfg->ccu_has_timings_switch) {
>  		/*
>