lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CABXOdTdKpqsqajhQzQ1aEp6bsa96ONN6nz9EWZv6jGSuN0_LTA@mail.gmail.com>
Date:   Mon, 18 Jul 2022 06:28:22 -0700
From:   Guenter Roeck <groeck@...gle.com>
To:     Tzung-Bi Shih <tzungbi@...nel.org>
Cc:     Benson Leung <bleung@...omium.org>,
        Guenter Roeck <groeck@...omium.org>,
        "open list:CHROME HARDWARE PLATFORM SUPPORT" 
        <chrome-platform@...ts.linux.dev>,
        linux-kernel <linux-kernel@...r.kernel.org>,
        kernel test robot <lkp@...el.com>
Subject: Re: [PATCH v2] platform/chrome: cros_kbd_led_backlight: fix build warning

On Mon, Jul 18, 2022 at 3:51 AM Tzung-Bi Shih <tzungbi@...nel.org> wrote:
>
> drivers/platform/chrome/cros_kbd_led_backlight.c got a new build warning
> when using the randconfig in [1]:
> >>> warning: unused variable 'keyboard_led_drvdata_ec_pwm'
>
> The warning happens when CONFIG_CROS_EC is set but CONFIG_OF is not set.
> Reproduce:
> - mkdir build_dir
> - wget [1] -O build_dir/.config
> - COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 \
>   O=build_dir ARCH=s390 SHELL=/bin/bash drivers/platform/chrome/
>
> Fix the warning by using __maybe_unused.  Also use IS_ENABLED() because
> CROS_EC is a tristate.

Is that sufficient ? What happens if CROS_KBD_LED_BACKLIGHT=y and
CROS_EC=m ? I suspect you might need IS_REACHABLE() instead of
IS_ENABLED().

Thanks,
Guenter

>
> [1]: https://download.01.org/0day-ci/archive/20220717/202207170538.MR39dw8m-lkp@intel.com/config
>
> Fixes: 40f58143745e ("platform/chrome: cros_kbd_led_backlight: support EC PWM backend")
> Reported-by: kernel test robot <lkp@...el.com>
> Signed-off-by: Tzung-Bi Shih <tzungbi@...nel.org>
> ---
> Changes from v1 (https://patchwork.kernel.org/project/chrome-platform/patch/20220718061608.2303425-1-tzungbi@kernel.org/):
> - Use __maybe_unused.
>
>  drivers/platform/chrome/cros_kbd_led_backlight.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/platform/chrome/cros_kbd_led_backlight.c b/drivers/platform/chrome/cros_kbd_led_backlight.c
> index 5ad41c10412d..793fd3f1015d 100644
> --- a/drivers/platform/chrome/cros_kbd_led_backlight.c
> +++ b/drivers/platform/chrome/cros_kbd_led_backlight.c
> @@ -119,7 +119,7 @@ static const struct keyboard_led_drvdata keyboard_led_drvdata_acpi = {
>
>  #endif /* CONFIG_ACPI */
>
> -#ifdef CONFIG_CROS_EC
> +#if IS_ENABLED(CONFIG_CROS_EC)
>
>  static int
>  keyboard_led_set_brightness_ec_pwm(struct led_classdev *cdev,
> @@ -180,18 +180,18 @@ static int keyboard_led_init_ec_pwm(struct platform_device *pdev)
>         return 0;
>  }
>
> -static const struct keyboard_led_drvdata keyboard_led_drvdata_ec_pwm = {
> +static const __maybe_unused struct keyboard_led_drvdata keyboard_led_drvdata_ec_pwm = {
>         .init = keyboard_led_init_ec_pwm,
>         .brightness_set_blocking = keyboard_led_set_brightness_ec_pwm,
>         .brightness_get = keyboard_led_get_brightness_ec_pwm,
>         .max_brightness = KEYBOARD_BACKLIGHT_MAX,
>  };
>
> -#else /* CONFIG_CROS_EC */
> +#else /* IS_ENABLED(CONFIG_CROS_EC) */
>
> -static const struct keyboard_led_drvdata keyboard_led_drvdata_ec_pwm = {};
> +static const __maybe_unused struct keyboard_led_drvdata keyboard_led_drvdata_ec_pwm = {};
>
> -#endif /* CONFIG_CROS_EC */
> +#endif /* IS_ENABLED(CONFIG_CROS_EC) */
>
>  static int keyboard_led_probe(struct platform_device *pdev)
>  {
> --
> 2.37.0.170.g444d1eabd0-goog
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ