Skip to content

Commit e6790fd

Browse files
arndbdavem330
authored andcommitted
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. Signed-off-by: Arnd Bergmann <[email protected]> Fixes: aad7e08 ("net/mlx5e: Hardware offloaded flower filter statistics support") Fixes: 00175ae ("net/sched: Macro instead of CONFIG_NET_CLS_ACT ifdef") Acked-By: Amir Vadai <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent b7552e1 commit e6790fd

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

include/net/act_api.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ static inline void tcf_action_stats_update(struct tc_action *a, u64 bytes,
192192
#else /* CONFIG_NET_CLS_ACT */
193193

194194
#define tc_no_actions(_exts) true
195-
#define tc_for_each_action(_a, _exts) while (0)
195+
#define tc_for_each_action(_a, _exts) while ((void)(_a), 0)
196196
#define tcf_action_stats_update(a, bytes, packets, lastuse)
197197

198198
#endif /* CONFIG_NET_CLS_ACT */

0 commit comments

Comments
 (0)