gpio: grgpio: Avoid potential NULL pointer dereference
authorAxel Lin <axel.lin@ingics.com>
Sat, 20 Dec 2014 14:47:07 +0000 (22:47 +0800)
committerLinus Walleij <linus.walleij@linaro.org>
Thu, 8 Jan 2015 19:14:00 +0000 (20:14 +0100)
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>
drivers/gpio/gpio-grgpio.c

index 09daaf2aeb563d982c71807b8155df4b2c50a6c5..3a5a71050559c7c52964a5b55764ef9b16e82361 100644 (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;
        }
 
This page took 0.028497 seconds and 5 git commands to generate.