Using dev_err_probe() can avoid spamming logs when probe is deferred.
This function can also help to reduce code the size, uniform error handling
and simplify the code.

Signed-off-by: Muhammad Husaini Zulkifli <[email protected]>
Acked-by: Adrian Hunter <[email protected]>
Acked-by: Andy Shevchenko <[email protected]>
---
 drivers/mmc/host/sdhci-of-arasan.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/drivers/mmc/host/sdhci-of-arasan.c 
b/drivers/mmc/host/sdhci-of-arasan.c
index 4e6ee9e69a1b..585ca32ff330 100644
--- a/drivers/mmc/host/sdhci-of-arasan.c
+++ b/drivers/mmc/host/sdhci-of-arasan.c
@@ -1545,15 +1545,14 @@ static int sdhci_arasan_probe(struct platform_device 
*pdev)
 
        sdhci_arasan->clk_ahb = devm_clk_get(dev, "clk_ahb");
        if (IS_ERR(sdhci_arasan->clk_ahb)) {
-               dev_err(dev, "clk_ahb clock not found.\n");
-               ret = PTR_ERR(sdhci_arasan->clk_ahb);
+               ret = dev_err_probe(dev, PTR_ERR(sdhci_arasan->clk_ahb),
+                                   "clk_ahb clock not found.\n");
                goto err_pltfm_free;
        }
 
        clk_xin = devm_clk_get(dev, "clk_xin");
        if (IS_ERR(clk_xin)) {
-               dev_err(dev, "clk_xin clock not found.\n");
-               ret = PTR_ERR(clk_xin);
+               ret = dev_err_probe(dev, PTR_ERR(clk_xin), "clk_xin clock not 
found.\n");
                goto err_pltfm_free;
        }
 
@@ -1606,8 +1605,7 @@ static int sdhci_arasan_probe(struct platform_device 
*pdev)
 
        ret = mmc_of_parse(host->mmc);
        if (ret) {
-               if (ret != -EPROBE_DEFER)
-                       dev_err(dev, "parsing dt failed (%d)\n", ret);
+               ret = dev_err_probe(dev, ret, "parsing dt failed.\n");
                goto unreg_clk;
        }
 
@@ -1615,8 +1613,8 @@ static int sdhci_arasan_probe(struct platform_device 
*pdev)
        if (of_device_is_compatible(np, "arasan,sdhci-5.1")) {
                sdhci_arasan->phy = devm_phy_get(dev, "phy_arasan");
                if (IS_ERR(sdhci_arasan->phy)) {
-                       ret = PTR_ERR(sdhci_arasan->phy);
-                       dev_err(dev, "No phy for arasan,sdhci-5.1.\n");
+                       ret = dev_err_probe(dev, PTR_ERR(sdhci_arasan->phy),
+                                           "No phy for arasan,sdhci-5.1.\n");
                        goto unreg_clk;
                }
 
-- 
2.17.1

Reply via email to