[1/4] net/ixgbe: fix warning with GCC 9 on Fedora 30

Message ID 20190501195014.2938-2-bruce.richardson@intel.com (mailing list archive)
State Accepted, archived
Headers
Series fix warnings with gcc 9 on Fedora 30 |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/intel-Performance-Testing success Performance Testing PASS
ci/mellanox-Performance-Testing success Performance Testing PASS
ci/Intel-compilation success Compilation OK

Commit Message

Bruce Richardson May 1, 2019, 7:50 p.m. UTC
  Compiling on Fedora 30, we get the following warning, causing build failure
when Werror flag is set:

../drivers/net/ixgbe/ixgbe_rxtx.c:2141:14: warning: ‘nmb’ may be used uninitialized in this function [-Wmaybe-uninitialized]
 2141 |    rxe->mbuf = nmb;
      |    ~~~~~~~~~~^~~~~

Initializing the value to "NULL" fixes the issue.

Fixes: 8eecb3295aed ("ixgbe: add LRO support")
Cc: vladz@cloudius-systems.com

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
 drivers/net/ixgbe/ixgbe_rxtx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

David Marchand May 2, 2019, 12:20 p.m. UTC | #1
On Wed, May 1, 2019 at 9:50 PM Bruce Richardson <bruce.richardson@intel.com>
wrote:

> Compiling on Fedora 30, we get the following warning, causing build failure
> when Werror flag is set:
>
> ../drivers/net/ixgbe/ixgbe_rxtx.c:2141:14: warning: ‘nmb’ may be used
> uninitialized in this function [-Wmaybe-uninitialized]
>  2141 |    rxe->mbuf = nmb;
>       |    ~~~~~~~~~~^~~~~
>
> Initializing the value to "NULL" fixes the issue.
>
> Fixes: 8eecb3295aed ("ixgbe: add LRO support")
> Cc: vladz@cloudius-systems.com
>
> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> ---
>  drivers/net/ixgbe/ixgbe_rxtx.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/ixgbe/ixgbe_rxtx.c
> b/drivers/net/ixgbe/ixgbe_rxtx.c
> index e71d3c188..1fbc754ae 100644
> --- a/drivers/net/ixgbe/ixgbe_rxtx.c
> +++ b/drivers/net/ixgbe/ixgbe_rxtx.c
> @@ -2029,7 +2029,7 @@ ixgbe_recv_pkts_lro(void *rx_queue, struct rte_mbuf
> **rx_pkts, uint16_t nb_pkts,
>                 struct ixgbe_rx_entry *next_rxe = NULL;
>                 struct rte_mbuf *first_seg;
>                 struct rte_mbuf *rxm;
> -               struct rte_mbuf *nmb;
> +               struct rte_mbuf *nmb = NULL;
>                 union ixgbe_adv_rx_desc rxd;
>                 uint16_t data_len;
>                 uint16_t next_id;
> --
> 2.21.0
>
>
Tested-by: David Marchand <david.marchand@redhat.com>
  

Patch

diff --git a/drivers/net/ixgbe/ixgbe_rxtx.c b/drivers/net/ixgbe/ixgbe_rxtx.c
index e71d3c188..1fbc754ae 100644
--- a/drivers/net/ixgbe/ixgbe_rxtx.c
+++ b/drivers/net/ixgbe/ixgbe_rxtx.c
@@ -2029,7 +2029,7 @@  ixgbe_recv_pkts_lro(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts,
 		struct ixgbe_rx_entry *next_rxe = NULL;
 		struct rte_mbuf *first_seg;
 		struct rte_mbuf *rxm;
-		struct rte_mbuf *nmb;
+		struct rte_mbuf *nmb = NULL;
 		union ixgbe_adv_rx_desc rxd;
 		uint16_t data_len;
 		uint16_t next_id;