gpio: gpio-tb10x: remove duplicate check on resource
authorVarka Bhadram <varkabhadram@gmail.com>
Tue, 21 Oct 2014 07:13:00 +0000 (12:43 +0530)
committerLinus Walleij <linus.walleij@linaro.org>
Tue, 28 Oct 2014 16:07:32 +0000 (17:07 +0100)
Sanity check on resource happening with devm_ioremap_resource().

Signed-off-by: Varka Bhadram <varkab@cdac.in>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/gpio/gpio-tb10x.c

index 9e615be8032ce5a328d777a1808b3d55ba5e78d8..8b1e8c0dd2fb838d15879d9ac1830810d3b5e23c 100644 (file)
@@ -195,18 +195,13 @@ static int tb10x_gpio_probe(struct platform_device *pdev)
        if (of_property_read_u32(dn, "abilis,ngpio", &ngpio))
                return -EINVAL;
 
-       mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-       if (!mem) {
-               dev_err(&pdev->dev, "No memory resource defined.\n");
-               return -EINVAL;
-       }
-
        tb10x_gpio = devm_kzalloc(&pdev->dev, sizeof(*tb10x_gpio), GFP_KERNEL);
        if (tb10x_gpio == NULL)
                return -ENOMEM;
 
        spin_lock_init(&tb10x_gpio->spinlock);
 
+       mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
        tb10x_gpio->base = devm_ioremap_resource(&pdev->dev, mem);
        if (IS_ERR(tb10x_gpio->base))
                return PTR_ERR(tb10x_gpio->base);