lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  PHC 
Open Source and information security mailing list archives
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Sun, 31 Aug 2014 16:51:54 +0530
From:	Pramod Gurav <>
Cc:	Jean-Christophe Plagniol-Villard <>,
	Linus Walleij <>
Subject: [PATCH 3/4] pinctrl: at91: Fix error handling while doing gpiochio_irqchip_add

This patch removes a call to panic function when gpiochio_irqchip_add
fails and just returns the error to the calling function.
Same return value is used to handle the error case and adds to lable
to release resources on error.

This also changes first argument to function at91_gpio_of_irq_setup from
struct device_node to struct platform_device. Because The device_node
argument was anyway not being used. Passed pdev so that on failure dev_err
can use &pdev->dev and log can be associated with proper device.

CC: Jean-Christophe Plagniol-Villard <>
CC: Linus Walleij <>
Signed-off-by: Pramod Gurav <>
 drivers/pinctrl/pinctrl-at91.c |   14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/drivers/pinctrl/pinctrl-at91.c b/drivers/pinctrl/pinctrl-at91.c
index 7abe683..8b8772c 100644
--- a/drivers/pinctrl/pinctrl-at91.c
+++ b/drivers/pinctrl/pinctrl-at91.c
@@ -1445,7 +1445,7 @@ static void gpio_irq_handler(unsigned irq, struct irq_desc *desc)
 	/* now it may re-trigger */
-static int at91_gpio_of_irq_setup(struct device_node *node,
+static int at91_gpio_of_irq_setup(struct platform_device *pdev,
 				  struct at91_gpio_chip *at91_gpio)
 	struct at91_gpio_chip   *prev = NULL;
@@ -1470,9 +1470,11 @@ static int at91_gpio_of_irq_setup(struct device_node *node,
-	if (ret)
-		panic("at91_gpio.%d: couldn't allocate irq domain (DT).\n",
+	if (ret) {
+		dev_err(&pdev->dev, "at91_gpio.%d: couldn't allocate irq domain (DT).\n",
+		return ret;
+	}
 	/* Setup chained handler */
 	if (at91_gpio->pioc_idx)
@@ -1640,12 +1642,16 @@ static int at91_gpio_probe(struct platform_device *pdev)
-	at91_gpio_of_irq_setup(np, at91_chip);
+	ret = at91_gpio_of_irq_setup(pdev, at91_chip);
+	if (ret)
+		goto irq_setup_err;
 	dev_info(&pdev->dev, "at address %p\n", at91_chip->regbase);
 	return 0;
+	gpiochip_remove(chip);

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

Powered by blists - more mailing lists