* [PATCH] mlx5: avoid unused variable warning
@ 2016-05-18 14:21 Arnd Bergmann
2016-05-18 15:11 ` Amir Vadai"
2016-05-20 18:24 ` David Miller
0 siblings, 2 replies; 3+ messages in thread
From: Arnd Bergmann @ 2016-05-18 14:21 UTC (permalink / raw)
To: David S. Miller
Cc: Jiri Pirko, John Fastabend, Amir Vadai, Arnd Bergmann, netdev,
linux-kernel
When CONFIG_NET_CLS_ACT is disabled, we get a new warning in the mlx5
ethernet driver because the tc_for_each_action() loop never references
the iterator:
mellanox/mlx5/core/en_tc.c: In function 'mlx5e_stats_flower':
mellanox/mlx5/core/en_tc.c:431:20: error: unused variable 'a' [-Werror=unused-variable]
struct tc_action *a;
This changes the dummy tc_for_each_action() macro by adding a
cast to void, letting the compiler know that the variable is
intentionally declared but not used here. I could not come up
with a nicer workaround, but this seems to do the trick.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Fixes: aad7e08d39bd ("net/mlx5e: Hardware offloaded flower filter statistics support")
Fixes: 00175aec941e ("net/sched: Macro instead of CONFIG_NET_CLS_ACT ifdef")
---
include/net/act_api.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/net/act_api.h b/include/net/act_api.h
index 2cd9e9bb059a..9a9a8edc138f 100644
--- a/include/net/act_api.h
+++ b/include/net/act_api.h
@@ -192,7 +192,7 @@ static inline void tcf_action_stats_update(struct tc_action *a, u64 bytes,
#else /* CONFIG_NET_CLS_ACT */
#define tc_no_actions(_exts) true
-#define tc_for_each_action(_a, _exts) while (0)
+#define tc_for_each_action(_a, _exts) while ((void)(_a), 0)
#define tcf_action_stats_update(a, bytes, packets, lastuse)
#endif /* CONFIG_NET_CLS_ACT */
--
2.7.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] mlx5: avoid unused variable warning
2016-05-18 14:21 [PATCH] mlx5: avoid unused variable warning Arnd Bergmann
@ 2016-05-18 15:11 ` Amir Vadai"
2016-05-20 18:24 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: Amir Vadai" @ 2016-05-18 15:11 UTC (permalink / raw)
To: Arnd Bergmann
Cc: David S. Miller, Jiri Pirko, John Fastabend, Amir Vadai, netdev,
linux-kernel
On Wed, May 18, 2016 at 04:21:07PM +0200, Arnd Bergmann wrote:
> When CONFIG_NET_CLS_ACT is disabled, we get a new warning in the mlx5
> ethernet driver because the tc_for_each_action() loop never references
> the iterator:
>
> mellanox/mlx5/core/en_tc.c: In function 'mlx5e_stats_flower':
> mellanox/mlx5/core/en_tc.c:431:20: error: unused variable 'a' [-Werror=unused-variable]
> struct tc_action *a;
>
> This changes the dummy tc_for_each_action() macro by adding a
> cast to void, letting the compiler know that the variable is
> intentionally declared but not used here. I could not come up
> with a nicer workaround, but this seems to do the trick.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> Fixes: aad7e08d39bd ("net/mlx5e: Hardware offloaded flower filter statistics support")
> Fixes: 00175aec941e ("net/sched: Macro instead of CONFIG_NET_CLS_ACT ifdef")
> ---
Acked-By: Amir Vadai <amir@vadai.me>
Thanks Arnd.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] mlx5: avoid unused variable warning
2016-05-18 14:21 [PATCH] mlx5: avoid unused variable warning Arnd Bergmann
2016-05-18 15:11 ` Amir Vadai"
@ 2016-05-20 18:24 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2016-05-20 18:24 UTC (permalink / raw)
To: arnd; +Cc: jiri, john.r.fastabend, amirva, netdev, linux-kernel
From: Arnd Bergmann <arnd@arndb.de>
Date: Wed, 18 May 2016 16:21:07 +0200
> When CONFIG_NET_CLS_ACT is disabled, we get a new warning in the mlx5
> ethernet driver because the tc_for_each_action() loop never references
> the iterator:
>
> mellanox/mlx5/core/en_tc.c: In function 'mlx5e_stats_flower':
> mellanox/mlx5/core/en_tc.c:431:20: error: unused variable 'a' [-Werror=unused-variable]
> struct tc_action *a;
>
> This changes the dummy tc_for_each_action() macro by adding a
> cast to void, letting the compiler know that the variable is
> intentionally declared but not used here. I could not come up
> with a nicer workaround, but this seems to do the trick.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> Fixes: aad7e08d39bd ("net/mlx5e: Hardware offloaded flower filter statistics support")
> Fixes: 00175aec941e ("net/sched: Macro instead of CONFIG_NET_CLS_ACT ifdef")
Applied, thanks Arnd.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-05-20 18:24 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-18 14:21 [PATCH] mlx5: avoid unused variable warning Arnd Bergmann
2016-05-18 15:11 ` Amir Vadai"
2016-05-20 18:24 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).