From: Axel Lin Date: Sat, 20 Dec 2014 14:47:07 +0000 (+0800) Subject: gpio: grgpio: Avoid potential NULL pointer dereference X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=879828c6ade916d13a5187eb02546899c2cd496c;p=GitHub%2Fexynos8895%2Fandroid_kernel_samsung_universal8895.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 09daaf2aeb56..3a5a71050559 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; }