gpio: grgpio: Avoid potential NULL pointer dereference

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 <[email protected]>
Signed-off-by: Linus Walleij <[email protected]>
This commit is contained in:
Axel Lin 2014-12-20 22:47:07 +08:00 • committed by Linus Walleij
commit 879828c6ad

View file

@ -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;
}