watchdog: shwdt: Remove the unnecessary check of resource after platform_get_resource()
authorGeorge Cherian <george.cherian@ti.com>
Tue, 10 Jun 2014 04:40:08 +0000 (10:10 +0530)
committerWim Van Sebroeck <wim@iguana.be>
Tue, 5 Aug 2014 20:42:56 +0000 (22:42 +0200)
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 <george.cherian@ti.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
drivers/watchdog/shwdt.c

index 061756e36cf8ddabeed3854b41aa615221bcb62e..fa89bb30d00443d8dfec2c9100ac7c3b6d60b5af 100644 (file)
@@ -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);