net/txgbe: fix build by simplifying xstats return
authorConor Walsh <conor.walsh@intel.com>
Wed, 11 Nov 2020 15:39:33 +0000 (15:39 +0000)
committerFerruh Yigit <ferruh.yigit@intel.com>
Fri, 13 Nov 2020 18:43:26 +0000 (19:43 +0100)
commitf8b41a8e377153e11ebf8e67349708506e17a88f
tree4de507bf52cb518db3e547e41301873270050072
parentcb99500de915040339f294b6ad2fc8edb4085b19
net/txgbe: fix build by simplifying xstats return

When DPDK is compiled with gcc 7.5 with the optimization level set to 1
gcc sees the 'offset' variable in txgbe_ethdev.c as possibly being
uninitialised.
The 'txgbe_get_offset_by_id()' return value, "-(int)(id + 1)", seems
confusing gcc that it assumes '0' can be returned in the failure case.
To correct this the return statement for error case in
'txgbe_get_offset_by_id()' is simplified to return '-1'.

Fixes: 91fe49c87d76 ("net/txgbe: support device xstats")

Signed-off-by: Conor Walsh <conor.walsh@intel.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
drivers/net/txgbe/txgbe_ethdev.c