Skip to content

Commit

Permalink
gpio: etraxfs: Fix devm_ioremap_resource return value check
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Krzysztof Kozlowski authored and Linus Walleij committed Jul 17, 2015
1 parent 7285860 commit 0154031
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/gpio/gpio-etraxfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 0154031

Please sign in to comment.