From: Axel Lin Date: Sat, 20 Dec 2014 14:47:07 +0000 (+0800) Subject: gpio: grgpio: Avoid potential NULL pointer dereference X-Git-Tag: v3.19-rc5~31^2~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=879828c6ade916d13a5187eb02546899c2cd496c;p=platform%2Fkernel%2Flinux-exynos.git 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 Signed-off-by: Linus Walleij --- diff --git a/drivers/gpio/gpio-grgpio.c b/drivers/gpio/gpio-grgpio.c index 09daaf2..3a5a710 100644 --- a/drivers/gpio/gpio-grgpio.c +++ b/drivers/gpio/gpio-grgpio.c @@ -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; }