[v2] net/txgbe: return changed to fix gcc compile error

Message ID 20201111153933.1951384-1-conor.walsh@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Ferruh Yigit
Headers
Series [v2] net/txgbe: return changed to fix gcc compile error |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-testing success Testing PASS
ci/travis-robot success Travis build: passed
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS

Commit Message

Conor Walsh Nov. 11, 2020, 3:39 p.m. UTC
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. To correct this the final return statement in
txgbe_get_offset_by_id was simplified to return -1.

Signed-off-by: Conor Walsh <conor.walsh@intel.com>
---
 drivers/net/txgbe/txgbe_ethdev.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
  

Comments

Ferruh Yigit Nov. 12, 2020, 3:05 p.m. UTC | #1
On 11/11/2020 3:39 PM, Conor Walsh wrote:
> 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. To correct this the final return statement in
> txgbe_get_offset_by_id was simplified to return -1.
> 
> Signed-off-by: Conor Walsh <conor.walsh@intel.com>

Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>

Applied to dpdk-next-net/main, thanks.
  

Patch

diff --git a/drivers/net/txgbe/txgbe_ethdev.c b/drivers/net/txgbe/txgbe_ethdev.c
index 9f533603a1..f8dffe1f12 100644
--- a/drivers/net/txgbe/txgbe_ethdev.c
+++ b/drivers/net/txgbe/txgbe_ethdev.c
@@ -2140,9 +2140,8 @@  txgbe_get_offset_by_id(uint32_t id, uint32_t *offset)
 			nb * (TXGBE_NB_QP_STATS * sizeof(uint64_t));
 		return 0;
 	}
-	id -= TXGBE_NB_QP_STATS * TXGBE_MAX_QP;
 
-	return -(int)(id + 1);
+	return -1;
 }
 
 static int txgbe_dev_xstats_get_names(struct rte_eth_dev *dev,