aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAxel Lin <axel.lin@ingics.com>2014-12-20 09:47:07 -0500
committerLinus Walleij <linus.walleij@linaro.org>2015-01-08 14:14:00 -0500
commit879828c6ade916d13a5187eb02546899c2cd496c (patch)
tree70712e3645f4c0ee39ca4bb9642ca47b7e4f5d66
parent5afb287a06ce869827563cbd2b0a035800dd6f5d (diff)
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 <axel.lin@ingics.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
-rw-r--r--drivers/gpio/gpio-grgpio.c3
1 files changed, 2 insertions, 1 deletions
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)
441 err = gpiochip_add(gc); 441 err = gpiochip_add(gc);
442 if (err) { 442 if (err) {
443 dev_err(&ofdev->dev, "Could not add gpiochip\n"); 443 dev_err(&ofdev->dev, "Could not add gpiochip\n");
444 irq_domain_remove(priv->domain); 444 if (priv->domain)
445 irq_domain_remove(priv->domain);
445 return err; 446 return err;
446 } 447 }
447 448