gpio: etraxfs: Fix devm_ioremap_resource return value check
authorKrzysztof Kozlowski <k.kozlowski.k@gmail.com>
Thu, 9 Jul 2015 13:19:53 +0000 (22:19 +0900)
committerLinus Walleij <linus.walleij@linaro.org>
Fri, 17 Jul 2015 07:48:00 +0000 (09:48 +0200)
Value returned by devm_ioremap_resource() was checked for non-NULL but
devm_ioremap_resource() returns IOMEM_ERR_PTR, not NULL. In case of
error this could lead to dereference of ERR_PTR.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski.k@gmail.com>
Acked-by: Alexandre Courbot <acourbot@nvidia.com>
Acked-by: Rabin Vincent <rabin@rab.in>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/gpio/gpio-etraxfs.c

index 28071f4a56724b94d15d5c418e8189b7cef697eb..0e643140efdef6d8f0d0cd293f71e70c6d0fce3f 100644 (file)
@@ -117,8 +117,8 @@ static int etraxfs_gpio_probe(struct platform_device *pdev)
 
        res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
        regs = devm_ioremap_resource(dev, res);
-       if (!regs)
-               return -ENOMEM;
+       if (IS_ERR(regs))
+               return PTR_ERR(regs);
 
        match = of_match_node(etraxfs_gpio_of_table, dev->of_node);
        if (!match)
This page took 0.029814 seconds and 5 git commands to generate.