Skip to contentSkip to conversation

pwm: Remove a redundant error message when devm_request_and_ioremap fails

PATCH Applied Axel Lin 3 participants 3 messages Aug 3, 2012 – Aug 9, 2012

Subsystems (3)
lore
Share & tools
lore

Axel Lin

author
#0 lore raw

PATCH 1/1 pwm: Remove a redundant error message when devm_request_and_ioremap fails

The implementation in devm_request_and_ioremap() already shows error message, so no need to show dev_err again if devm_request_and_ioremap() fails.

Cc Stephen Warren <[email protected]>
Cc Philip, Avinash <[email protected]>
---
 drivers/pwm/pwm-tegra.c    |    4 +---
 drivers/pwm/pwm-tiecap.c   |    4 +---
 drivers/pwm/pwm-tiehrpwm.c |    4 +---
 3 files changed, 3 insertions(+), 9 deletions(-)
drivers/pwm/pwm-tegra.c +1 -3
index 02ce18d..057465e 100644
@@ -187,10 +187,8 @@ static int tegra_pwm_probe(struct platform_device *pdev)
 	}
 
 	pwm->mmio_base = devm_request_and_ioremap(&pdev->dev, r);
-	if (!pwm->mmio_base) {
-		dev_err(&pdev->dev, "failed to ioremap() region\n");
+	if (!pwm->mmio_base)
 		return -EADDRNOTAVAIL;
-	}
 
 	platform_set_drvdata(pdev, pwm);
 
drivers/pwm/pwm-tiecap.c +1 -3
index 3c2ad28..0b66d0f 100644
@@ -192,10 +192,8 @@ static int __devinit ecap_pwm_probe(struct platform_device *pdev)
 	}
 
 	pc->mmio_base = devm_request_and_ioremap(&pdev->dev, r);
-	if (!pc->mmio_base) {
-		dev_err(&pdev->dev, "failed to ioremap() registers\n");
+	if (!pc->mmio_base)
 		return -EADDRNOTAVAIL;
-	}
 
 	ret = pwmchip_add(&pc->chip);
 	if (ret < 0) {
drivers/pwm/pwm-tiehrpwm.c +1 -3
index 010d232..c3756d1 100644
@@ -371,10 +371,8 @@ static int __devinit ehrpwm_pwm_probe(struct platform_device *pdev)
 	}
 
 	pc->mmio_base = devm_request_and_ioremap(&pdev->dev, r);
-	if (!pc->mmio_base) {
-		dev_err(&pdev->dev, "failed to ioremap() registers\n");
+	if (!pc->mmio_base)
 		return  -EADDRNOTAVAIL;
-	}
 
 	ret = pwmchip_add(&pc->chip);
 	if (ret < 0) {
Signature · 1 line
1.7.9.5
#1 lore raw
Quoted 2 lines · Axel Lin

The implementation in devm_request_and_ioremap() already shows error message, so no need to show dev_err again if devm_request_and_ioremap() fails.

I don't have any issue with this patch, but a general comment:

It sure would be nice if there was some way to easily tell which functions did already print an error message. In some drivers I've written, I've made sure that every failure path prints an error message so it's easy to track down failures. However, if some functions already do this and some don't, only some call sites in the driver will have error prints, so it'll look inconsistent, as if some error messages were forgotten:-(

#2 lore raw
In reply to Axel Lin
Quoted 7 lines · Axel Lin

The implementation in devm_request_and_ioremap() already shows error message, so no need to show dev_err again if devm_request_and_ioremap() fails.

Cc Stephen Warren <[email protected]>
Cc Philip, Avinash <[email protected]>

---

Applied, thanks. I'll carry this in for-next and master. I collect fixes in the latter and plan to submit them for 3.6.

Thierry