gpio: x-gene: fix devm_ioremap_resource() check
authorVladimir Zapolskiy <vz@mleia.com>
Sun, 29 Mar 2015 02:37:20 +0000 (05:37 +0300)
committerLinus Walleij <linus.walleij@linaro.org>
Wed, 8 Apr 2015 07:53:57 +0000 (09:53 +0200)
devm_ioremap_resource() returns IOMEM_ERR_PTR() and it never
returns NULL, fix the check to prevent access to invalid
virtual address.

Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/gpio/gpio-xgene-sb.c

index b6a15c3..fb9d29a 100644 (file)
@@ -93,7 +93,7 @@ static int xgene_gpio_sb_probe(struct platform_device *pdev)
 
        res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
        regs = devm_ioremap_resource(&pdev->dev, res);
-       if (!regs)
+       if (IS_ERR(regs))
                return PTR_ERR(regs);
 
        ret = bgpio_init(&priv->bgc, &pdev->dev, 4,