Commit 01540314 authored by Krzysztof Kozlowski's avatar Krzysztof Kozlowski Committed by Linus Walleij

gpio: etraxfs: Fix devm_ioremap_resource return value check

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: default avatarKrzysztof Kozlowski <k.kozlowski.k@gmail.com>
Acked-by: default avatarAlexandre Courbot <acourbot@nvidia.com>
Acked-by: default avatarRabin Vincent <rabin@rab.in>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent 72858602
...@@ -117,8 +117,8 @@ static int etraxfs_gpio_probe(struct platform_device *pdev) ...@@ -117,8 +117,8 @@ static int etraxfs_gpio_probe(struct platform_device *pdev)
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
regs = devm_ioremap_resource(dev, res); regs = devm_ioremap_resource(dev, res);
if (!regs) if (IS_ERR(regs))
return -ENOMEM; return PTR_ERR(regs);
match = of_match_node(etraxfs_gpio_of_table, dev->of_node); match = of_match_node(etraxfs_gpio_of_table, dev->of_node);
if (!match) if (!match)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment