mlx5: avoid unused variable warning
Subsystems (2)
PATCH 1/1 mlx5: avoid unused variable warning
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.
--- include/net/act_api.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/net/act_api.h +1 -1
@@ -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 */
Signature · 1 line
2.7.0
Quoted 13 lines · Arnd Bergmann
When
CONFIG_NET_CLS_ACTis disabled, we get a new warning in the mlx5 ethernet driver because thetc_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]
structtc_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.
Quoted 4 lines
Signed-off-by Arnd Bergmann <[email protected]>Fixes aad7e08d39bd ("net/mlx5e: Hardware offloaded flower filter statistics support")Fixes 00175aec941e ("net/sched: Macro instead of CONFIG_NET_CLS_ACT ifdef")---
Thanks Arnd.
From: Arnd Bergmann <[email protected]>
Date: Wed, 18 May 2016 16:21:07 +0200
Quoted 8 lines
When
CONFIG_NET_CLS_ACTis disabled, we get a new warning in the mlx5 ethernet driver because thetc_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]
structtc_action*a;
Quoted 8 lines
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 <[email protected]>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.