950-silence-unused-variable-warnings.patch 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. From: Mieczyslaw Nalewaj <[email protected]>
  2. Date: Wed, 07 Jan 2026 01:30:15 +0100
  3. Subject: [PATCH] Silence unused-variable warnings in ipv6.h and tcp_input.c
  4. This patch silences compiler warnings about unused variables by explicitly
  5. casting them to void where appropriate.
  6. Signed-off-by: Mieczyslaw Nalewaj <[email protected]>
  7. ---
  8. include/net/ipv6.h | 6 ++++++
  9. net/ipv4/tcp_input.c | 7 +++++++
  10. 2 files changed, 13 insertions(+)
  11. --- a/include/net/ipv6.h
  12. +++ b/include/net/ipv6.h
  13. @@ -248,6 +248,8 @@ extern int sysctl_mld_qrv;
  14. struct inet6_dev *_idev = (idev); \
  15. unsigned long _field = (field); \
  16. unsigned long _val = (val); \
  17. + (void)_field; \
  18. + (void)_val; \
  19. if (likely(_idev != NULL)) \
  20. mod##SNMP_ADD_STATS((_idev)->stats.statname, _field, _val); \
  21. mod##SNMP_ADD_STATS((net)->mib.statname##_statistics, _field, _val);\
  22. @@ -257,6 +259,7 @@ extern int sysctl_mld_qrv;
  23. ({ \
  24. struct inet6_dev *_idev = (idev); \
  25. unsigned long _val = (val); \
  26. + (void)_val; \
  27. if (likely(_idev != NULL)) \
  28. mod##SNMP_UPD_PO_STATS((_idev)->stats.statname, field, _val); \
  29. mod##SNMP_UPD_PO_STATS((net)->mib.statname##_statistics, field, _val);\
  30. --- a/net/ipv4/tcp_input.c
  31. +++ b/net/ipv4/tcp_input.c
  32. @@ -3967,6 +3967,12 @@ static u32 tcp_newly_delivered(struct so
  33. struct tcp_sock *tp = tcp_sk(sk);
  34. u32 delivered;
  35. + /* ecn_count is only used when FLAG_ECE is set; in some build/config
  36. + * paths it may be unused and cause a compiler warning. Silence it
  37. + * explicitly here.
  38. + */
  39. + (void)ecn_count;
  40. +
  41. delivered = tp->delivered - prior_delivered;
  42. NET_ADD_STATS(net, LINUX_MIB_TCPDELIVERED, delivered);