]>
Commit | Line | Data |
---|---|---|
04fd09d4 SL |
1 | From 9680b6eea68fdead145acb393227069fad9d0c09 Mon Sep 17 00:00:00 2001 |
2 | From: Arnd Bergmann <arnd@arndb.de> | |
3 | Date: Thu, 7 Mar 2019 16:52:24 +0100 | |
4 | Subject: enic: fix build warning without CONFIG_CPUMASK_OFFSTACK | |
5 | ||
6 | [ Upstream commit 43d281662fdb46750d49417559b71069f435298d ] | |
7 | ||
8 | The enic driver relies on the CONFIG_CPUMASK_OFFSTACK feature to | |
9 | dynamically allocate a struct member, but this is normally intended for | |
10 | local variables. | |
11 | ||
12 | Building with clang, I get a warning for a few locations that check the | |
13 | address of the cpumask_var_t: | |
14 | ||
15 | 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] | |
16 | ||
17 | As far as I can tell, the code is still correct, as the truth value of | |
18 | the pointer is what we need in this configuration. To get rid of | |
19 | the warning, use cpumask_available() instead of checking the | |
20 | pointer directly. | |
21 | ||
22 | Fixes: 322cf7e3a4e8 ("enic: assign affinity hint to interrupts") | |
23 | Signed-off-by: Arnd Bergmann <arnd@arndb.de> | |
24 | Reviewed-by: Nathan Chancellor <natechancellor@gmail.com> | |
25 | Signed-off-by: David S. Miller <davem@davemloft.net> | |
26 | Signed-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 | ||
31 | diff --git a/drivers/net/ethernet/cisco/enic/enic_main.c b/drivers/net/ethernet/cisco/enic/enic_main.c | |
32 | index 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 | -- | |
63 | 2.19.1 | |
64 |