Skip to content

Commit

Permalink
gpio: grgpio: Avoid potential NULL pointer dereference
Browse files Browse the repository at this point in the history
irqmap is optional property, so priv->domain can be NULL if !irqmap.
Thus add NULL test for priv->domain before calling irq_domain_remove()
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 Jan 8, 2015
1 parent 5afb287 commit 879828c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/gpio/gpio-grgpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,8 @@ static int grgpio_probe(struct platform_device *ofdev)
err = gpiochip_add(gc);
if (err) {
dev_err(&ofdev->dev, "Could not add gpiochip\n");
irq_domain_remove(priv->domain);
if (priv->domain)
irq_domain_remove(priv->domain);
return err;
}

Expand Down

0 comments on commit 879828c

Please sign in to comment.