[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20100521122141.3d9d5fdf.akpm@linux-foundation.org>
Date: Fri, 21 May 2010 12:21:41 -0700
From: Andrew Morton <akpm@...ux-foundation.org>
To: Daniel Mack <daniel@...aq.de>
Cc: linux-kernel@...r.kernel.org,
Denis Turischev <denis@...pulab.co.il>
Subject: Re: [PATCH] drivers/gpio/it8761e_gpio: check return value of
gpiochip_remove()
On Wed, 19 May 2010 17:28:33 +0200
Daniel Mack <daniel@...aq.de> wrote:
> This eliminates the following build warning:
>
> drivers/gpio/it8761e_gpio.c: In function ___it8761e_gpio_exit___:
> drivers/gpio/it8761e_gpio.c:220: warning: ignoring return value of ___gpiochip_remove___, declared with attribute warn_unused_result
>
> Signed-off-by: Daniel Mack <daniel@...aq.de>
> Cc: Andrew Morton <akpm@...ux-foundation.org>
> Cc: Denis Turischev <denis@...pulab.co.il>
> ---
> drivers/gpio/it8761e_gpio.c | 5 ++++-
> 1 files changed, 4 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/gpio/it8761e_gpio.c b/drivers/gpio/it8761e_gpio.c
> index 753219c..a524bd8 100644
> --- a/drivers/gpio/it8761e_gpio.c
> +++ b/drivers/gpio/it8761e_gpio.c
> @@ -217,7 +217,10 @@ gpiochip_add_err:
> static void __exit it8761e_gpio_exit(void)
> {
> if (gpio_ba) {
> - gpiochip_remove(&it8761e_gpio_chip);
> + int ret = gpiochip_remove(&it8761e_gpio_chip);
> +
> + WARN(ret, "%s(): gpiochip_remove() failed, ret=%d\n",
> + __func__, ret);
>
> release_region(gpio_ba, GPIO_IOSIZE);
> gpio_ba = 0;
So I just looked through ten-odd gpio drivers to see how they handle
gpiochip_remove() failures. Big mess.
All of them do some form of printk, with no consistency.
Some of them bale out on error, leaking resources. Others just proceed
to release the possibly-in-use resources.
I'd suggest that gpiochip_remove() itself emit the warning, so we can
remove zillions of inconsistent warnings from drivers.
I'd also suggest that someone get down and work out what a suitable
recovery strategy is. Probably, just leaking the possibly-still-used
resources is the safest approach. Once the strategy is decided, lots
of drivers need work.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists