summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>2023-06-21 20:49:41 +0300
committerBartosz Golaszewski <bartosz.golaszewski@linaro.org>2023-07-10 11:29:44 +0200
commit39f3ad73d4465d0333444bd5adce052f8e1c2783 (patch)
tree2258b3bd17348416dae1a3a574f507998273799f
parent1efc43de1781bbb8780ee6f6f2291073003f1ff1 (diff)
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: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
-rw-r--r--drivers/gpio/gpiolib.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index 796d2802ebb9..e4300b99bfa5 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -1650,6 +1650,7 @@ static int gpiochip_add_irqchip(struct gpio_chip *gc,
{
struct fwnode_handle *fwnode = dev_fwnode(&gc->gpiodev->dev);
struct irq_chip *irqchip = gc->irq.chip;
+ struct irq_domain *domain;
unsigned int type;
unsigned int i;
@@ -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 (gpiochip_hierarchy_is_hierarchical(gc)) {
- gc->irq.domain = gpiochip_hierarchy_create_domain(gc);
- if (IS_ERR(gc->irq.domain))
- return PTR_ERR(gc->irq.domain);
+ domain = gpiochip_hierarchy_create_domain(gc);
} else {
- gc->irq.domain = gpiochip_simple_create_domain(gc);
- if (IS_ERR(gc->irq.domain))
- return PTR_ERR(gc->irq.domain);
+ domain = gpiochip_simple_create_domain(gc);
}
+ if (IS_ERR(domain))
+ return PTR_ERR(domain);
+ gc->irq.domain = domain;
if (gc->irq.parent_handler) {
for (i = 0; i < gc->irq.num_parents; i++) {