From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thomas Monjalon Subject: [PATCH 3/5] net/mlx4: fix possible uninitialized variable Date: Fri, 16 Nov 2018 17:58:52 +0100 Message-ID: <20181116165854.24017-4-thomas@monjalon.net> References: <20181116165854.24017-1-thomas@monjalon.net> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: stable@dpdk.org To: dev@dpdk.org Return-path: In-Reply-To: <20181116165854.24017-1-thomas@monjalon.net> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 --- drivers/net/mlx4/mlx4_ethdev.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/net/mlx4/mlx4_ethdev.c b/drivers/net/mlx4/mlx4_ethdev.c index 30deb3ef0..195a1b6df 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; -- 2.19.0