Re: [PATCH] pinctrl: core: Fix unused variable build warnings

From: Linus Walleij
Date: Tue Dec 01 2020 - 18:07:15 EST


On Mon, Nov 23, 2020 at 11:41 PM Pawan Gupta <writetopawan@xxxxxxxxx> wrote:

> A recent commit f1b206cf7c57 ("pinctrl: core: print gpio in pins debugfs
> file") added build warnings when CONFIG_GPIOLIB=n. Offcourse the kernel
> fails to build when warnings are treated as errors. Below is the error
> message:
>
> $ make CFLAGS_KERNEL+=-Werror
>
> drivers/pinctrl/core.c: In function ‘pinctrl_pins_show’:
> drivers/pinctrl/core.c:1607:20: error: unused variable ‘chip’ [-Werror=unused-variable]
> 1607 | struct gpio_chip *chip;
> | ^~~~
> drivers/pinctrl/core.c:1606:15: error: unused variable ‘gpio_num’ [-Werror=unused-variable]
> 1606 | unsigned int gpio_num;
> | ^~~~~~~~
> drivers/pinctrl/core.c:1605:29: error: unused variable ‘range’ [-Werror=unused-variable]
> 1605 | struct pinctrl_gpio_range *range;
> | ^~~~~
> cc1: all warnings being treated as errors
>
> These variables are only used inside #ifdef CONFIG_GPIOLIB, fix the
> build warnings by wrapping the definition inside the config.
>
> Fixes: f1b206cf7c57 ("pinctrl: core: print gpio in pins debugfs file")
> Signed-off-by: Pawan Gupta <writetopawan@xxxxxxxxx>

This was fixed in
commit b507cb92477ad85902783a183c5ce01d16296687
"pinctrl: core: Add missing #ifdef CONFIG_GPIOLIB"
On october 28.

Thanks anyways!

Yours,
Linus Walleij