summaryrefslogtreecommitdiff
path: root/drivers/net/ethernet/chelsio/cxgb
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2021-09-27 14:16:04 +0200
committerDavid S. Miller <davem@davemloft.net>2021-09-27 14:04:23 +0100
commitef5d6356e2ace045fd388c1b6effb2253642b5c4 (patch)
tree7b42e6d91d799349729d6960f378f1b57bd89398 /drivers/net/ethernet/chelsio/cxgb
parent3e0d5699a975718efe048edc6f61fbe1cf50e51e (diff)
cxgb: avoid open-coded offsetof()
clang-14 does not like the custom offsetof() macro in vsc7326: drivers/net/ethernet/chelsio/cxgb/vsc7326.c:597:3: error: performing pointer subtraction with a null pointer has undefined behavior [-Werror,-Wnull-pointer-subtraction] HW_STAT(RxUnicast, RxUnicastFramesOK), ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/net/ethernet/chelsio/cxgb/vsc7326.c:594:56: note: expanded from macro 'HW_STAT' { reg, (&((struct cmac_statistics *)NULL)->stat_name) - (u64 *)NULL } Rewrite this to use the version provided by the kernel. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/chelsio/cxgb')
-rw-r--r--drivers/net/ethernet/chelsio/cxgb/vsc7326.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/net/ethernet/chelsio/cxgb/vsc7326.c b/drivers/net/ethernet/chelsio/cxgb/vsc7326.c
index 873c1c7b4ca0..a19284bdb80e 100644
--- a/drivers/net/ethernet/chelsio/cxgb/vsc7326.c
+++ b/drivers/net/ethernet/chelsio/cxgb/vsc7326.c
@@ -591,7 +591,7 @@ static void port_stats_update(struct cmac *mac)
} hw_stats[] = {
#define HW_STAT(reg, stat_name) \
- { reg, (&((struct cmac_statistics *)NULL)->stat_name) - (u64 *)NULL }
+ { reg, offsetof(struct cmac_statistics, stat_name) / sizeof(u64) }
/* Rx stats */
HW_STAT(RxUnicast, RxUnicastFramesOK),