Skip to contentSkip to conversation

mmc/host/sdhci-of-arasan.c: Use signed formatting in error messages

PATCH Applied Mike Looijmans 3 participants 8 messages Oct 23, 2014 – Oct 28, 2014

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 mmc/host/sdhci-of-arasan.c: Use signed formatting in error messages

"ret" is a signed int, so use "%d" in format strings instead of "%u". This prevents cryptic codes in error messages like this:
sdhci-arasan e0101000.sdhci: platform register failed (4294966779)

---
 drivers/mmc/host/sdhci-of-arasan.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/mmc/host/sdhci-of-arasan.c +2 -2
index 8cf81c3..7ac6718 100644
@@ -161,7 +161,7 @@ static int sdhci_arasan_probe(struct platform_device *pdev)
 	host = sdhci_pltfm_init(pdev, &sdhci_arasan_pdata, 0);
 	if (IS_ERR(host)) {
 		ret = PTR_ERR(host);
-		dev_err(&pdev->dev, "platform init failed (%u)\n", ret);
+		dev_err(&pdev->dev, "platform init failed (%d)\n", ret);
 		goto clk_disable_all;
 	}
 
@@ -172,7 +172,7 @@ static int sdhci_arasan_probe(struct platform_device *pdev)
 
 	ret = sdhci_add_host(host);
 	if (ret) {
-		dev_err(&pdev->dev, "platform register failed (%u)\n", ret);
+		dev_err(&pdev->dev, "platform register failed (%d)\n", ret);
 		goto err_pltfm_free;
 	}
 
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH 2/2 mmc/host/sdhci-of-arasan.c: Skip EPROBE_DEFER error messages

When the error code is -EPROBE_DEFER, this will already be reported so don't emit an error message in that case.

---
 drivers/mmc/host/sdhci-of-arasan.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/mmc/host/sdhci-of-arasan.c +4 -2
index 7ac6718..d5812a0 100644
@@ -161,7 +161,8 @@ static int sdhci_arasan_probe(struct platform_device *pdev)
 	host = sdhci_pltfm_init(pdev, &sdhci_arasan_pdata, 0);
 	if (IS_ERR(host)) {
 		ret = PTR_ERR(host);
-		dev_err(&pdev->dev, "platform init failed (%d)\n", ret);
+		if (ret != -EPROBE_DEFER)
+			dev_err(&pdev->dev, "platform init failed (%d)\n", ret);
 		goto clk_disable_all;
 	}
 
@@ -172,7 +173,8 @@ static int sdhci_arasan_probe(struct platform_device *pdev)
 
 	ret = sdhci_add_host(host);
 	if (ret) {
-		dev_err(&pdev->dev, "platform register failed (%d)\n", ret);
+		if (ret != -EPROBE_DEFER)
+			dev_err(&pdev->dev, "platform register failed (%d)\n", ret);
 		goto err_pltfm_free;
 	}
 
Signature · 1 line
1.7.9.5
#2 lore raw

Re: [PATCH 2/2] mmc/host/sdhci-of-arasan.c: Skip EPROBE_DEFER error messages

Hi Chris,

Quoted 23 lines · Mike Looijmans

When the error code is -EPROBE_DEFER, this will already be reported so don't emit an error message in that case.

---
 drivers/mmc/host/sdhci-of-arasan.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/mmc/host/sdhci-of-arasan.c +2 -1
index 7ac6718..d5812a0 100644
@@ -161,7 +161,8 @@ static int sdhci_arasan_probe(struct platform_device *pdev)
 	host = sdhci_pltfm_init(pdev, &sdhci_arasan_pdata, 0);
 	if (IS_ERR(host)) {
 		ret = PTR_ERR(host);
-		dev_err(&pdev->dev, "platform init failed (%d)\n", ret);
+		if (ret != -EPROBE_DEFER)
+			dev_err(&pdev->dev, "platform init failed (%d)\n", ret);
 		goto clk_disable_all;
 	}
 

drivers/mmc/host/sdhci-of-arasan.c static int sdhci_arasan_probe(struct platform_device *pdev) · line 179

Quoted 8 lines
drivers/mmc/host/sdhci-of-arasan.c +2 -1
@@ -172,7 +173,8 @@ static int sdhci_arasan_probe(struct platform_device *pdev)
 
 	ret = sdhci_add_host(host);
 	if (ret) {
-		dev_err(&pdev->dev, "platform register failed (%d)\n", ret);
+		if (ret != -EPROBE_DEFER)
+			dev_err(&pdev->dev, "platform register failed (%d)\n", ret);
 		goto err_pltfm_free;
 	}

I checked other drivers and they are not reporting these bugs. I have briefly looked at sdhci_add_host and sdhci_platfm_init and they are pretty good error description
+ core itself should report if driver probe failed.
That's why I think that it is just reasonable to remove these both dev_err completely.

What do you think?

Thanks,
Michal

#3 lore raw

Re: [PATCH 2/2] mmc/host/sdhci-of-arasan.c: Skip EPROBE_DEFER error messages

Quoted 41 lines · Michal Simek

Hi Chris,

Quoted 23 lines · Mike Looijmans

When the error code is -EPROBE_DEFER, this will already be reported so don't emit an error message in that case.

---
 drivers/mmc/host/sdhci-of-arasan.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/mmc/host/sdhci-of-arasan.c +2 -1
index 7ac6718..d5812a0 100644
@@ -161,7 +161,8 @@ static int sdhci_arasan_probe(struct platform_device *pdev)
      host = sdhci_pltfm_init(pdev, &sdhci_arasan_pdata, 0);
      if (IS_ERR(host)) {
              ret = PTR_ERR(host);
-             dev_err(&pdev->dev, "platform init failed (%d)\n", ret);
+             if (ret != -EPROBE_DEFER)
+                     dev_err(&pdev->dev, "platform init failed (%d)\n", ret);
              goto clk_disable_all;
      }
 

drivers/mmc/host/sdhci-of-arasan.c static int sdhci_arasan_probe(struct platform_device *pdev) · line 179

Quoted 8 lines
drivers/mmc/host/sdhci-of-arasan.c +2 -1
@@ -172,7 +173,8 @@ static int sdhci_arasan_probe(struct platform_device *pdev)
 
      ret = sdhci_add_host(host);
      if (ret) {
-             dev_err(&pdev->dev, "platform register failed (%d)\n", ret);
+             if (ret != -EPROBE_DEFER)
+                     dev_err(&pdev->dev, "platform register failed (%d)\n", ret);
              goto err_pltfm_free;
      }

I checked other drivers and they are not reporting these bugs. I have briefly looked at sdhci_add_host and sdhci_platfm_init and they are pretty good error description
+ core itself should report if driver probe failed.
That's why I think that it is just reasonable to remove these both dev_err completely.

Quoted 1 line

What do you think?

I agree, this seems reasonable!

Kind regards
Uffe

#4 lore raw

Re: [PATCH 2/2] mmc/host/sdhci-of-arasan.c: Skip EPROBE_DEFER error messages

As discussed here, I'll post a new patch which simply removes the error messages.

#5 lore raw

PATCH 1/1 mmc/host/sdhci-of-arasan.c: Omit superfluous error messages

sdhci_add_host and sdhci_platfm_init already report failure, so don't emit error messages when a failure occurs. This prevents occurences of "deferred" messages when required power supplies are not ready for operation yet.

---
 drivers/mmc/host/sdhci-of-arasan.c |    5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/mmc/host/sdhci-of-arasan.c +1 -4
index 7ac6718..75bea2e 100644
@@ -161,7 +161,6 @@ static int sdhci_arasan_probe(struct platform_device *pdev)
 	host = sdhci_pltfm_init(pdev, &sdhci_arasan_pdata, 0);
 	if (IS_ERR(host)) {
 		ret = PTR_ERR(host);
-		dev_err(&pdev->dev, "platform init failed (%d)\n", ret);
 		goto clk_disable_all;
 	}
 
@@ -171,10 +170,8 @@ static int sdhci_arasan_probe(struct platform_device *pdev)
 	pltfm_host->clk = clk_xin;
 
 	ret = sdhci_add_host(host);
-	if (ret) {
-		dev_err(&pdev->dev, "platform register failed (%d)\n", ret);
+	if (ret)
 		goto err_pltfm_free;
-	}
 
 	return 0;
 
Signature · 1 line
1.7.9.5
Applied
#6 lore raw

Re: [PATCH] mmc/host/sdhci-of-arasan.c: Omit superfluous error messages

Quoted 6 lines · Mike Looijmans

sdhci_add_host and sdhci_platfm_init already report failure, so don't emit error messages when a failure occurs. This prevents occurences of "deferred" messages when required power supplies are not ready for operation yet.

Thanks! Applied for next.

Kind regards
Uffe

Quoted 31 lines
---
 drivers/mmc/host/sdhci-of-arasan.c |    5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/mmc/host/sdhci-of-arasan.c +1 -5
index 7ac6718..75bea2e 100644
@@ -161,7 +161,6 @@ static int sdhci_arasan_probe(struct platform_device *pdev)
        host = sdhci_pltfm_init(pdev, &sdhci_arasan_pdata, 0);
        if (IS_ERR(host)) {
                ret = PTR_ERR(host);
-               dev_err(&pdev->dev, "platform init failed (%d)\n", ret);
                goto clk_disable_all;
        }
 
@@ -171,10 +170,8 @@ static int sdhci_arasan_probe(struct platform_device *pdev)
        pltfm_host->clk = clk_xin;
 
        ret = sdhci_add_host(host);
-       if (ret) {
-               dev_err(&pdev->dev, "platform register failed (%d)\n", ret);
+       if (ret)
                goto err_pltfm_free;
-       }
 
        return 0;
 
--

1.7.9.5

Applied
#7 lore raw
In reply to Mike Looijmans
Quoted 6 lines · Mike Looijmans

"ret" is a signed int, so use "%d" in format strings instead of "%u". This prevents cryptic codes in error messages like this:
sdhci-arasan e0101000.sdhci: platform register failed (4294966779)

Thanks! Applied for next.

I will expect a v2 of patch2.

Kind regards
Uffe

Quoted 29 lines
---
 drivers/mmc/host/sdhci-of-arasan.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/mmc/host/sdhci-of-arasan.c +2 -3
index 8cf81c3..7ac6718 100644
@@ -161,7 +161,7 @@ static int sdhci_arasan_probe(struct platform_device *pdev)
        host = sdhci_pltfm_init(pdev, &sdhci_arasan_pdata, 0);
        if (IS_ERR(host)) {
                ret = PTR_ERR(host);
-               dev_err(&pdev->dev, "platform init failed (%u)\n", ret);
+               dev_err(&pdev->dev, "platform init failed (%d)\n", ret);
                goto clk_disable_all;
        }
 
@@ -172,7 +172,7 @@ static int sdhci_arasan_probe(struct platform_device *pdev)
 
        ret = sdhci_add_host(host);
        if (ret) {
-               dev_err(&pdev->dev, "platform register failed (%u)\n", ret);
+               dev_err(&pdev->dev, "platform register failed (%d)\n", ret);
                goto err_pltfm_free;
        }
 
--

1.7.9.5