Commit 39f3ad73 authored by Andy Shevchenko's avatar Andy Shevchenko Committed by Bartosz Golaszewski

gpiolib: Do not assign error pointer to the GPIO IRQ chip domain

Check domain for being an error pointer before assigning it to
the GPIO IRQ chip domain.
Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: default avatarLinus Walleij <linus.walleij@linaro.org>
Signed-off-by: default avatarBartosz Golaszewski <bartosz.golaszewski@linaro.org>
parent 1efc43de
...@@ -1650,6 +1650,7 @@ static int gpiochip_add_irqchip(struct gpio_chip *gc, ...@@ -1650,6 +1650,7 @@ static int gpiochip_add_irqchip(struct gpio_chip *gc,
{ {
struct fwnode_handle *fwnode = dev_fwnode(&gc->gpiodev->dev); struct fwnode_handle *fwnode = dev_fwnode(&gc->gpiodev->dev);
struct irq_chip *irqchip = gc->irq.chip; struct irq_chip *irqchip = gc->irq.chip;
struct irq_domain *domain;
unsigned int type; unsigned int type;
unsigned int i; unsigned int i;
...@@ -1682,14 +1683,13 @@ static int gpiochip_add_irqchip(struct gpio_chip *gc, ...@@ -1682,14 +1683,13 @@ static int gpiochip_add_irqchip(struct gpio_chip *gc,
/* If a parent irqdomain is provided, let's build a hierarchy */ /* If a parent irqdomain is provided, let's build a hierarchy */
if (gpiochip_hierarchy_is_hierarchical(gc)) { if (gpiochip_hierarchy_is_hierarchical(gc)) {
gc->irq.domain = gpiochip_hierarchy_create_domain(gc); domain = gpiochip_hierarchy_create_domain(gc);
if (IS_ERR(gc->irq.domain))
return PTR_ERR(gc->irq.domain);
} else { } else {
gc->irq.domain = gpiochip_simple_create_domain(gc); domain = gpiochip_simple_create_domain(gc);
if (IS_ERR(gc->irq.domain))
return PTR_ERR(gc->irq.domain);
} }
if (IS_ERR(domain))
return PTR_ERR(domain);
gc->irq.domain = domain;
if (gc->irq.parent_handler) { if (gc->irq.parent_handler) {
for (i = 0; i < gc->irq.num_parents; i++) { for (i = 0; i < gc->irq.num_parents; i++) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment