]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/4.14.111/enic-fix-build-warning-without-config_cpumask_offsta.patch
5.1-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 4.14.111 / enic-fix-build-warning-without-config_cpumask_offsta.patch
CommitLineData
04fd09d4
SL
1From 9680b6eea68fdead145acb393227069fad9d0c09 Mon Sep 17 00:00:00 2001
2From: Arnd Bergmann <arnd@arndb.de>
3Date: Thu, 7 Mar 2019 16:52:24 +0100
4Subject: enic: fix build warning without CONFIG_CPUMASK_OFFSTACK
5
6[ Upstream commit 43d281662fdb46750d49417559b71069f435298d ]
7
8The enic driver relies on the CONFIG_CPUMASK_OFFSTACK feature to
9dynamically allocate a struct member, but this is normally intended for
10local variables.
11
12Building with clang, I get a warning for a few locations that check the
13address of the cpumask_var_t:
14
15drivers/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]
16
17As far as I can tell, the code is still correct, as the truth value of
18the pointer is what we need in this configuration. To get rid of
19the warning, use cpumask_available() instead of checking the
20pointer directly.
21
22Fixes: 322cf7e3a4e8 ("enic: assign affinity hint to interrupts")
23Signed-off-by: Arnd Bergmann <arnd@arndb.de>
24Reviewed-by: Nathan Chancellor <natechancellor@gmail.com>
25Signed-off-by: David S. Miller <davem@davemloft.net>
26Signed-off-by: Sasha Levin <sashal@kernel.org>
27---
28 drivers/net/ethernet/cisco/enic/enic_main.c | 6 +++---
29 1 file changed, 3 insertions(+), 3 deletions(-)
30
31diff --git a/drivers/net/ethernet/cisco/enic/enic_main.c b/drivers/net/ethernet/cisco/enic/enic_main.c
32index ced348e15a63..19f374b180fc 100644
33--- a/drivers/net/ethernet/cisco/enic/enic_main.c
34+++ b/drivers/net/ethernet/cisco/enic/enic_main.c
35@@ -119,7 +119,7 @@ static void enic_init_affinity_hint(struct enic *enic)
36
37 for (i = 0; i < enic->intr_count; i++) {
38 if (enic_is_err_intr(enic, i) || enic_is_notify_intr(enic, i) ||
39- (enic->msix[i].affinity_mask &&
40+ (cpumask_available(enic->msix[i].affinity_mask) &&
41 !cpumask_empty(enic->msix[i].affinity_mask)))
42 continue;
43 if (zalloc_cpumask_var(&enic->msix[i].affinity_mask,
44@@ -148,7 +148,7 @@ static void enic_set_affinity_hint(struct enic *enic)
45 for (i = 0; i < enic->intr_count; i++) {
46 if (enic_is_err_intr(enic, i) ||
47 enic_is_notify_intr(enic, i) ||
48- !enic->msix[i].affinity_mask ||
49+ !cpumask_available(enic->msix[i].affinity_mask) ||
50 cpumask_empty(enic->msix[i].affinity_mask))
51 continue;
52 err = irq_set_affinity_hint(enic->msix_entry[i].vector,
53@@ -161,7 +161,7 @@ static void enic_set_affinity_hint(struct enic *enic)
54 for (i = 0; i < enic->wq_count; i++) {
55 int wq_intr = enic_msix_wq_intr(enic, i);
56
57- if (enic->msix[wq_intr].affinity_mask &&
58+ if (cpumask_available(enic->msix[wq_intr].affinity_mask) &&
59 !cpumask_empty(enic->msix[wq_intr].affinity_mask))
60 netif_set_xps_queue(enic->netdev,
61 enic->msix[wq_intr].affinity_mask,
62--
632.19.1
64