Skip to content

Commit

Permalink
gpio: xgene: Prevent NULL pointer dereference
Browse files Browse the repository at this point in the history
platform_get_resource() can return NULL, thus add NULL test to prevent NULL
pointer dereference.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
  • Loading branch information
Axel Lin authored and Linus Walleij committed Mar 30, 2016
1 parent fd975a7 commit 8d8ee18
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions drivers/gpio/gpio-xgene.c
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,11 @@ static int xgene_gpio_probe(struct platform_device *pdev)
}

res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!res) {
err = -EINVAL;
goto err;
}

gpio->base = devm_ioremap_nocache(&pdev->dev, res->start,
resource_size(res));
if (!gpio->base) {
Expand Down

0 comments on commit 8d8ee18

Please sign in to comment.