2012-08-03 13:44:01

by Axel Lin

[permalink] [raw]
Subject: [PATCH] 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.

Signed-off-by: Axel Lin <[email protected]>
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(-)

diff --git a/drivers/pwm/pwm-tegra.c b/drivers/pwm/pwm-tegra.c
index 02ce18d..057465e 100644
--- a/drivers/pwm/pwm-tegra.c
+++ b/drivers/pwm/pwm-tegra.c
@@ -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);

diff --git a/drivers/pwm/pwm-tiecap.c b/drivers/pwm/pwm-tiecap.c
index 3c2ad28..0b66d0f 100644
--- a/drivers/pwm/pwm-tiecap.c
+++ b/drivers/pwm/pwm-tiecap.c
@@ -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) {
diff --git a/drivers/pwm/pwm-tiehrpwm.c b/drivers/pwm/pwm-tiehrpwm.c
index 010d232..c3756d1 100644
--- a/drivers/pwm/pwm-tiehrpwm.c
+++ b/drivers/pwm/pwm-tiehrpwm.c
@@ -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) {
--
1.7.9.5



2012-08-03 15:38:00

by Stephen Warren

[permalink] [raw]
Subject: Re: [PATCH] pwm: Remove a redundant error message when devm_request_and_ioremap fails

On 08/03/2012 07:43 AM, Axel Lin wrote:
> 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:-(

2012-08-09 05:41:58

by Thierry Reding

[permalink] [raw]
Subject: Re: [PATCH] pwm: Remove a redundant error message when devm_request_and_ioremap fails

On Fri, Aug 03, 2012 at 09:43:54PM +0800, Axel Lin wrote:
> 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.
>
> Signed-off-by: Axel Lin <[email protected]>
> 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


Attachments:
(No filename) (486.00 B)
(No filename) (836.00 B)
Download all attachments