[dpdk-dev] lpm: fix maybe-uninitialized warning when using LTO during compilation

Message ID 1417480746-25902-1-git-send-email-dmarinus@amazon.com (mailing list archive)
State Accepted, archived
Headers

Commit Message

Dennis Marinus Dec. 2, 2014, 12:39 a.m. UTC
  This patch fixes a maybe-uninitialized warning when compiling DPDK with
GCC 4.9 + Link Time Optimization.

Signed-off-by: Dennis Marinus <dmarinus@amazon.com>
---
 lib/librte_table/rte_table_lpm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Bruce Richardson Dec. 2, 2014, 9:16 a.m. UTC | #1
On Mon, Dec 01, 2014 at 04:39:06PM -0800, Dennis Marinus wrote:
> This patch fixes a maybe-uninitialized warning when compiling DPDK with
> GCC 4.9 + Link Time Optimization.
> 
> Signed-off-by: Dennis Marinus <dmarinus@amazon.com>

Acked-by: Bruce Richardson <bruce.richardson@intel.com>

> ---
>  lib/librte_table/rte_table_lpm.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/librte_table/rte_table_lpm.c b/lib/librte_table/rte_table_lpm.c
> index 59f87bb..cf92619 100644
> --- a/lib/librte_table/rte_table_lpm.c
> +++ b/lib/librte_table/rte_table_lpm.c
> @@ -185,7 +185,7 @@ rte_table_lpm_entry_add(
>  	struct rte_table_lpm_key *ip_prefix = (struct rte_table_lpm_key *) key;
>  	uint32_t nht_pos, nht_pos0_valid;
>  	int status;
> -	uint8_t nht_pos0;
> +	uint8_t nht_pos0 = 0;
>  
>  	/* Check input parameters */
>  	if (lpm == NULL) {
> -- 
> 2.1.2.AMZN
>
  
Thomas Monjalon Dec. 2, 2014, 11:34 a.m. UTC | #2
> > This patch fixes a maybe-uninitialized warning when compiling DPDK with
> > GCC 4.9 + Link Time Optimization.
> > 
> > Signed-off-by: Dennis Marinus <dmarinus@amazon.com>
> 
> Acked-by: Bruce Richardson <bruce.richardson@intel.com>

Applied

Thanks
  

Patch

diff --git a/lib/librte_table/rte_table_lpm.c b/lib/librte_table/rte_table_lpm.c
index 59f87bb..cf92619 100644
--- a/lib/librte_table/rte_table_lpm.c
+++ b/lib/librte_table/rte_table_lpm.c
@@ -185,7 +185,7 @@  rte_table_lpm_entry_add(
 	struct rte_table_lpm_key *ip_prefix = (struct rte_table_lpm_key *) key;
 	uint32_t nht_pos, nht_pos0_valid;
 	int status;
-	uint8_t nht_pos0;
+	uint8_t nht_pos0 = 0;
 
 	/* Check input parameters */
 	if (lpm == NULL) {