From: Nathan Chancellor <natechancellor@gmail.com>
To: Arnd Bergmann <arnd@arndb.de>
Cc: Christian Benvenuti <benve@cisco.com>,
Govindarajulu Varadarajan <_govind@gmx.com>,
Parvi Kaustubhi <pkaustub@cisco.com>,
"David S. Miller" <davem@davemloft.net>,
Nick Desaulniers <ndesaulniers@google.com>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] [v2] enic: fix build warning without CONFIG_CPUMASK_OFFSTACK
Date: Thu, 7 Mar 2019 08:59:23 -0700 [thread overview]
Message-ID: <20190307155923.GA22197@archlinux-ryzen> (raw)
In-Reply-To: <20190307155230.2923527-1-arnd@arndb.de>
On Thu, Mar 07, 2019 at 04:52:24PM +0100, Arnd Bergmann wrote:
> 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@arndb.de>
Reviewed-by: Nathan Chancellor <natechancellor@gmail.com>
> ---
> v2: use cpumask_available() instead of open-coding a copy
> ---
> drivers/net/ethernet/cisco/enic/enic_main.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/ethernet/cisco/enic/enic_main.c b/drivers/net/ethernet/cisco/enic/enic_main.c
> index 9a7f70db20c7..733d9172425b 100644
> --- a/drivers/net/ethernet/cisco/enic/enic_main.c
> +++ b/drivers/net/ethernet/cisco/enic/enic_main.c
> @@ -119,7 +119,7 @@ static void enic_init_affinity_hint(struct enic *enic)
>
> for (i = 0; i < enic->intr_count; i++) {
> if (enic_is_err_intr(enic, i) || enic_is_notify_intr(enic, i) ||
> - (enic->msix[i].affinity_mask &&
> + (cpumask_available(enic->msix[i].affinity_mask) &&
> !cpumask_empty(enic->msix[i].affinity_mask)))
> continue;
> if (zalloc_cpumask_var(&enic->msix[i].affinity_mask,
> @@ -148,7 +148,7 @@ static void enic_set_affinity_hint(struct enic *enic)
> for (i = 0; i < enic->intr_count; i++) {
> if (enic_is_err_intr(enic, i) ||
> enic_is_notify_intr(enic, i) ||
> - !enic->msix[i].affinity_mask ||
> + !cpumask_available(enic->msix[i].affinity_mask) ||
> cpumask_empty(enic->msix[i].affinity_mask))
> continue;
> err = irq_set_affinity_hint(enic->msix_entry[i].vector,
> @@ -161,7 +161,7 @@ static void enic_set_affinity_hint(struct enic *enic)
> for (i = 0; i < enic->wq_count; i++) {
> int wq_intr = enic_msix_wq_intr(enic, i);
>
> - if (enic->msix[wq_intr].affinity_mask &&
> + if (cpumask_available(enic->msix[wq_intr].affinity_mask) &&
> !cpumask_empty(enic->msix[wq_intr].affinity_mask))
> netif_set_xps_queue(enic->netdev,
> enic->msix[wq_intr].affinity_mask,
> --
> 2.20.0
>
next prev parent reply other threads:[~2019-03-07 15:59 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-07 15:52 [PATCH] [v2] enic: fix build warning without CONFIG_CPUMASK_OFFSTACK Arnd Bergmann
2019-03-07 15:59 ` Nathan Chancellor [this message]
2019-03-07 17:42 ` David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190307155923.GA22197@archlinux-ryzen \
--to=natechancellor@gmail.com \
--cc=_govind@gmx.com \
--cc=arnd@arndb.de \
--cc=benve@cisco.com \
--cc=davem@davemloft.net \
--cc=linux-kernel@vger.kernel.org \
--cc=ndesaulniers@google.com \
--cc=netdev@vger.kernel.org \
--cc=pkaustub@cisco.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.