Re: [PATCH] pinctrl: pistachio: Use common error handling code in pistachio_gpio_register()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux