2014-06-10 04:41:54

by George Cherian

[permalink] [raw]
Subject: [PATCH 1/3] watchdog: dw_wdt: Remove the un-necessary check after platform_get_resource()

devm_ioremap_resource() checks for valid resource.
Remove the un-necessary check after platform_get_resource().

Signed-off-by: George Cherian <[email protected]>
---
drivers/watchdog/dw_wdt.c | 3 ---
1 file changed, 3 deletions(-)

diff --git a/drivers/watchdog/dw_wdt.c b/drivers/watchdog/dw_wdt.c
index ee4f86b..9f21029 100644
--- a/drivers/watchdog/dw_wdt.c
+++ b/drivers/watchdog/dw_wdt.c
@@ -296,9 +296,6 @@ static int dw_wdt_drv_probe(struct platform_device *pdev)
int ret;
struct resource *mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);

- if (!mem)
- return -EINVAL;
-
dw_wdt.regs = devm_ioremap_resource(&pdev->dev, mem);
if (IS_ERR(dw_wdt.regs))
return PTR_ERR(dw_wdt.regs);
--
1.8.3.1


2014-06-10 04:41:59

by George Cherian

[permalink] [raw]
Subject: [PATCH 3/3] watchdog: shwdt: Remove the unnecessary check of resource after platform_get_resource()

devm_ioremap_resource check for a valid resource. Remove the unnecessary check.
Also group platform_get_resource and devm_ioremap_resource together for better
readability.

Signed-off-by: George Cherian <[email protected]>
---
drivers/watchdog/shwdt.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/watchdog/shwdt.c b/drivers/watchdog/shwdt.c
index d04d02b..08205d7 100644
--- a/drivers/watchdog/shwdt.c
+++ b/drivers/watchdog/shwdt.c
@@ -230,10 +230,6 @@ static int sh_wdt_probe(struct platform_device *pdev)
if (pdev->id != -1)
return -EINVAL;

- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- if (unlikely(!res))
- return -EINVAL;
-
wdt = devm_kzalloc(&pdev->dev, sizeof(struct sh_wdt), GFP_KERNEL);
if (unlikely(!wdt))
return -ENOMEM;
@@ -249,6 +245,7 @@ static int sh_wdt_probe(struct platform_device *pdev)
wdt->clk = NULL;
}

+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
wdt->base = devm_ioremap_resource(wdt->dev, res);
if (IS_ERR(wdt->base))
return PTR_ERR(wdt->base);
--
1.8.3.1

2014-06-10 04:41:57

by George Cherian

[permalink] [raw]
Subject: [PATCH 2/3] watchdog: lantiq_wdt: Remove the un-necessary check of resource after platform_get_resource()

devm_ioremap_resource() checks for valid resource.
Remove the un-necessary check after platform_get_resource().

Signed-off-by: George Cherian <[email protected]>
---
drivers/watchdog/lantiq_wdt.c | 5 -----
1 file changed, 5 deletions(-)

diff --git a/drivers/watchdog/lantiq_wdt.c b/drivers/watchdog/lantiq_wdt.c
index 3b3148c..021e84e 100644
--- a/drivers/watchdog/lantiq_wdt.c
+++ b/drivers/watchdog/lantiq_wdt.c
@@ -192,11 +192,6 @@ ltq_wdt_probe(struct platform_device *pdev)
struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
struct clk *clk;

- if (!res) {
- dev_err(&pdev->dev, "cannot obtain I/O memory region");
- return -ENOENT;
- }
-
ltq_wdt_membase = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(ltq_wdt_membase))
return PTR_ERR(ltq_wdt_membase);
--
1.8.3.1

2014-06-10 19:23:41

by Guenter Roeck

[permalink] [raw]
Subject: Re: [PATCH 1/3] watchdog: dw_wdt: Remove the un-necessary check after platform_get_resource()

On Tue, Jun 10, 2014 at 10:10:06AM +0530, George Cherian wrote:
> devm_ioremap_resource() checks for valid resource.
> Remove the un-necessary check after platform_get_resource().
>
> Signed-off-by: George Cherian <[email protected]>

Reviewed-by: Guenter Roeck <[email protected]>

2014-06-10 19:24:09

by Guenter Roeck

[permalink] [raw]
Subject: Re: [PATCH 2/3] watchdog: lantiq_wdt: Remove the un-necessary check of resource after platform_get_resource()

On Tue, Jun 10, 2014 at 10:10:07AM +0530, George Cherian wrote:
> devm_ioremap_resource() checks for valid resource.
> Remove the un-necessary check after platform_get_resource().
>
> Signed-off-by: George Cherian <[email protected]>

Reviewed-by: Guenter Roeck <[email protected]>

2014-06-10 19:24:57

by Guenter Roeck

[permalink] [raw]
Subject: Re: [PATCH 3/3] watchdog: shwdt: Remove the unnecessary check of resource after platform_get_resource()

On Tue, Jun 10, 2014 at 10:10:08AM +0530, George Cherian wrote:
> devm_ioremap_resource check for a valid resource. Remove the unnecessary check.
> Also group platform_get_resource and devm_ioremap_resource together for better
> readability.
>
> Signed-off-by: George Cherian <[email protected]>

Reviewed-by: Guenter Roeck <[email protected]>