drivers/gpio/it8761e_gpio: check return value of gpiochip_remove()
PATCH 1/1 drivers/gpio/it8761e_gpio: check return value of gpiochip_remove()
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
--- drivers/gpio/it8761e_gpio.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-)
drivers/gpio/it8761e_gpio.c +4 -1
@@ -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 ;
Signature · 1 line
1.7.1
Quoted 18 lines · On Wed, 19 May 2010 17:28:33 +0200 Daniel Mack <[email protected]> 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 attributewarn_unused_resultSigned-off-by Daniel Mack <[email protected]>Cc Andrew Morton <[email protected]>Cc Denis Turischev <[email protected]>--- drivers/gpio/it8761e_gpio.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-)drivers/gpio/it8761e_gpio.c +0
-0@@ -217,7 +217,10 @@ gpiochip_add_err: static void __exit it8761e_gpio_exit(void)
drivers/gpio/it8761e_gpio.c gpiochip_add_err: · line 226
Quoted 10 lines
drivers/gpio/it8761e_gpio.c +4
-1{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.