Re: [PATCH] [v2] enic: fix build warning without CONFIG_CPUMASK_OFFSTACK

From: David Miller
Date: Thu Mar 07 2019 - 12:42:59 EST


From: Arnd Bergmann <arnd@xxxxxxxx>
Date: Thu, 7 Mar 2019 16:52:24 +0100

> The enic driver relies on the CONFIG_CPUMASK_OFFSTACK feature to
> dynamically allocate a struct member, but this is normally intended for
> local variables.
>
> Building with clang, I get a warning for a few locations that check the
> address of the cpumask_var_t:
>
> drivers/net/ethernet/cisco/enic/enic_main.c:122:22: error: address of array 'enic->msix[i].affinity_mask' will always evaluate to 'true' [-Werror,-Wpointer-bool-conversion]
>
> As far as I can tell, the code is still correct, as the truth value of
> the pointer is what we need in this configuration. To get rid of
> the warning, use cpumask_available() instead of checking the
> pointer directly.
>
> Fixes: 322cf7e3a4e8 ("enic: assign affinity hint to interrupts")
> Signed-off-by: Arnd Bergmann <arnd@xxxxxxxx>
> ---
> v2: use cpumask_available() instead of open-coding a copy

Applied.