diff mbox series

[v1,3/5] gpiolib: Do not assign error pointer to the GPIO IRQ chip domain

Message ID 20230621174943.30302-3-andriy.shevchenko@linux.intel.com
State Accepted
Commit 39f3ad73d4465d0333444bd5adce052f8e1c2783
Headers show
Series [v1,1/5] gpiolib: Make gpiochip_hierarchy_add_domain() return domain | expand

Commit Message

Andy Shevchenko June 21, 2023, 5:49 p.m. UTC
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>
---
 drivers/gpio/gpiolib.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

Comments

Linus Walleij June 30, 2023, 11:48 a.m. UTC | #1
On Wed, Jun 21, 2023 at 7:49 PM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:

> 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>

And this concludes patches 1,2,3, nice!
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij
diff mbox series

Patch

diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index fac1124d5016..0e40f9a44519 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -1647,6 +1647,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;
 
@@ -1679,14 +1680,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++) {