From: Thomas Monjalon Date: Fri, 16 Nov 2018 16:58:52 +0000 (+0100) Subject: net/mlx4: fix possible uninitialized variable X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=554f06d10b1c646f20d7011a30b26fb43507d596;p=dpdk.git net/mlx4: fix possible uninitialized variable When compiling with gcc -O1, this error appears: drivers/net/mlx4/mlx4_ethdev.c: In function ‘mlx4_rxmode_toggle’: rte_log.h:321:3: error: ‘mode’ may be used uninitialized in this function The function mlx4_rxmode_toggle is never called with a value which is not in the switch block, but GCC complains about it with -O1. So the default case is "fixed" by setting string "undefined". Fixes: eacaac7bae36 ("net/mlx4: restore promisc and allmulti support") Cc: stable@dpdk.org Signed-off-by: Thomas Monjalon --- diff --git a/drivers/net/mlx4/mlx4_ethdev.c b/drivers/net/mlx4/mlx4_ethdev.c index 30deb3ef01..195a1b6dfb 100644 --- a/drivers/net/mlx4/mlx4_ethdev.c +++ b/drivers/net/mlx4/mlx4_ethdev.c @@ -360,6 +360,8 @@ mlx4_rxmode_toggle(struct rte_eth_dev *dev, enum rxmode_toggle toggle) mode = "all multicast"; dev->data->all_multicast = toggle & 1; break; + default: + mode = "undefined"; } if (!mlx4_flow_sync(priv, &error)) return;