Skip to content

Commit f89c6ea

Browse files
masahir0ylinusw
authored andcommitted
gpio: brcmstb: check return value of gpiochip_irqchip_add()
Because gpiochip_irqchip_add() may fail, its return value should be checked. Signed-off-by: Masahiro Yamada <[email protected]> Acked-by: Gregory Fong <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
1 parent a863e87 commit f89c6ea

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

drivers/gpio/gpio-brcmstb.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,7 @@ static int brcmstb_gpio_irq_setup(struct platform_device *pdev,
339339
struct brcmstb_gpio_priv *priv = bank->parent_priv;
340340
struct device *dev = &pdev->dev;
341341
struct device_node *np = dev->of_node;
342+
int err;
342343

343344
bank->irq_chip.name = dev_name(dev);
344345
bank->irq_chip.irq_mask = brcmstb_gpio_irq_mask;
@@ -355,8 +356,6 @@ static int brcmstb_gpio_irq_setup(struct platform_device *pdev,
355356
dev_warn(dev,
356357
"Couldn't get wake IRQ - GPIOs will not be able to wake from sleep");
357358
} else {
358-
int err;
359-
360359
/*
361360
* Set wakeup capability before requesting wakeup
362361
* interrupt, so we can process boot-time "wakeups"
@@ -383,8 +382,10 @@ static int brcmstb_gpio_irq_setup(struct platform_device *pdev,
383382
if (priv->can_wake)
384383
bank->irq_chip.irq_set_wake = brcmstb_gpio_irq_set_wake;
385384

386-
gpiochip_irqchip_add(&bank->gc, &bank->irq_chip, 0,
387-
handle_simple_irq, IRQ_TYPE_NONE);
385+
err = gpiochip_irqchip_add(&bank->gc, &bank->irq_chip, 0,
386+
handle_simple_irq, IRQ_TYPE_NONE);
387+
if (err)
388+
return err;
388389
gpiochip_set_chained_irqchip(&bank->gc, &bank->irq_chip,
389390
priv->parent_irq, brcmstb_gpio_irq_handler);
390391

0 commit comments

Comments
 (0)