]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit - include/linux/of_gpio.h
gpiolib: always initialize *flags from of_get_named_gpio_flags
authorArnd Bergmann <arnd@arndb.de>
Fri, 1 Jan 2016 22:40:46 +0000 (23:40 +0100)
committerLinus Walleij <linus.walleij@linaro.org>
Mon, 4 Jan 2016 07:49:06 +0000 (08:49 +0100)
commit427e0dc57db7046385ed7618ab24aa5c58dccab1
treea23cd0f77e46e3bbb2add03a989ee2085ad7fff6
parente28ecca6eac40646780b83edab81a496cea3d220
gpiolib: always initialize *flags from of_get_named_gpio_flags

The of_get_named_gpio_flags() function does nothing other than returning
an error when CONFIG_OF_GPIO is disabled, but that causes spurious
warnings about possible use of uninitialized variables in any code that
does not check the of_get_named_gpio_flags() return value before trying
to use the flags:

drivers/input/misc/rotary_encoder.c: In function 'rotary_encoder_probe':
drivers/input/misc/rotary_encoder.c:223:28: warning: 'flags' may be used uninitialized in this function [-Wmaybe-uninitialized]
drivers/power/bq24735-charger.c: In function 'bq24735_charger_probe':
drivers/power/bq24735-charger.c:227:12: warning: 'flags' may be used uninitialized in this function [-Wmaybe-uninitialized]
drivers/power/sbs-battery.c: In function 'sbs_probe':
drivers/power/sbs-battery.c:782:17: warning: 'gpio_flags' may be used uninitialized in this function [-Wmaybe-uninitialized]

This changes the behavior of the inline helper to set the flags to zero
when OF_GPIO is disabled, to avoid the warnings. In all cases I've
encountered, we don't actually get to the place that uses the flags
if CONFIG_OF is disabled because we won't enter the DT parser code.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
include/linux/of_gpio.h