[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20171101101836.ubko2cmxeds6735j@mwanda>
Date: Wed, 1 Nov 2017 13:18:36 +0300
From: Dan Carpenter <dan.carpenter@...cle.com>
To: SF Markus Elfring <elfring@...rs.sourceforge.net>
Cc: linux-gpio@...r.kernel.org,
Andrew Bresticker <abrestic@...omium.org>,
Damien Horsley <Damien.Horsley@...tec.com>,
Ezequiel Garcia <ezequiel.garcia@...tec.com>,
Govindraj Raja <govindraj.raja@...tec.com>,
Kevin Cernekee <cernekee@...omium.org>,
Linus Walleij <linus.walleij@...aro.org>,
LKML <linux-kernel@...r.kernel.org>,
kernel-janitors <kernel-janitors@...r.kernel.org>,
James Hartley <james.hartley@...tec.com>,
James Hogan <james.hogan@...tec.com>
Subject: Re: [PATCH] pinctrl: pistachio: Use common error handling code in
pistachio_gpio_register()
On Mon, Oct 30, 2017 at 06:51:19PM +0100, SF Markus Elfring wrote:
> @@ -1409,13 +1408,15 @@ static int pistachio_gpio_register(struct pistachio_pinctrl *pctl)
> if (ret < 0) {
> dev_err(pctl->dev, "Failed to add GPIO range %u: %d\n",
> i, ret);
> - gpiochip_remove(&bank->gpio_chip);
> - goto err;
> + goto remove_chip;
It's better code to put the gpiochip_remove() before the goto, because
say we want to add more error handling before the remove_chip: label.
Now it doesn't work.
> }
> }
>
> return 0;
> -err:
> +
> +remove_chip:
> + gpiochip_remove(&bank->gpio_chip);
> +remove_chips:
> for (; i > 0; i--) {
> bank = &pctl->gpio_banks[i - 1];
> gpiochip_remove(&bank->gpio_chip);
regards,
dan carpenter
Powered by blists - more mailing lists