Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759541AbcJQWTu (ORCPT ); Mon, 17 Oct 2016 18:19:50 -0400 Received: from mout.kundenserver.de ([212.227.17.13]:62568 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757733AbcJQWTQ (ORCPT ); Mon, 17 Oct 2016 18:19:16 -0400 From: Arnd Bergmann To: Jiri Pirko Cc: Linus Torvalds , linux-kernel@vger.kernel.org, Arnd Bergmann , "David S. Miller" , Ido Schimmel , Dan Carpenter , netdev@vger.kernel.org Subject: [PATCH 27/28] rocker: fix maybe-uninitialized warning Date: Tue, 18 Oct 2016 00:16:15 +0200 Message-Id: <20161017221650.1902729-8-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20161017220342.1627073-1-arnd@arndb.de> References: <20161017220342.1627073-1-arnd@arndb.de> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Provags-ID: V03:K0:DzQtC9EbZGWpFd8l0l0z6WHjQuY0xpSwtJDfmEgdltOk4FyyJbj xQrUx22QlRYOEq+NKJRN7Y+5VxepprkcvxH4WK9FE5yB/c4413M1B76+/kdvnnRbmrmI4To WVBNyp5hSibOem+Seb/zeBp7z+JahUL3zaZEpyzIFtOkhpB+3qNMrLbzZAAfUvjZmyViLMn zM3KoDYNGm50F5xi20GGQ== X-UI-Out-Filterresults: notjunk:1;V01:K0:5zwsrfTAB/E=:8uHomFTllYUSr2UDw2lVNT 1+Lo27+gdxKinaICymIikPrOmAKzs8LjxoKeVk9Gmm+z6ycEo3BxjuPFBe5THGCpZpc+HHsHZ JMPHG3T7IIObIxlkQ2+jnruMB3bsdXf4N67R8JPww7pdZ+6B74G5adlh+eN5qtI1AsWfe2mLb X04bVdWWsVVnsfI0lEQ+eM56t4Paaf/gs4pMyBWzd2rEwbqGxNuFo47zKL0vfZfVWui5vq4u2 7kRm8OWKDkhfJ9cHgnVy1Vif0OPCyOM8mf70njEF+sTVk07ooskVZtmdAw2bmA7Ey3PvGosTJ ct7Q8v6EF+/NBj95q/TKwninDG41w770Q7tzf1xuo7ErJqa4nzaDRQfQV6C5bnzhstVYC7SxH ySnAKTPD2saNSVuLHtOhR9QGzROwHPthYcNUHRPtubWIwA6xPj7pKYuz0cicrOOWr3YboXoDI PirzDPCdtookjaa4OTJYxIX0gtW3LoE+b0t1cqwSKvF6ODrzwP/mvxTLZlKhytJkPcthbRmFf YEKoF8lbAkXQPtbUWM+MBsGnR2GjCanY26ijgSQ6F5xaaXy9NoiuQUlxBgtYM+pNsM48rcFF3 hZlDSZxBsb72MHKDTSDxlcRcb3uQVoXHqK4NN8PKoy8RuBJsuNITmgcpSj42mUp3KnZV3mmQv PrICx44pxExUl1F7EKfxfTuH/vSmnEBMmElrCeW0RiZ7rGxOC1ZzhJli6Abefkn+KH04k8Z8z 007mr9sjwJjpBCJA Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1647 Lines: 43 In some rare configurations, we get a warning about the 'index' variable being used without an initialization: drivers/net/ethernet/rocker/rocker_ofdpa.c: In function ‘ofdpa_port_fib_ipv4.isra.16.constprop’: drivers/net/ethernet/rocker/rocker_ofdpa.c:2425:92: warning: ‘index’ may be used uninitialized in this function [-Wmaybe-uninitialized] This is a false positive, the logic is just a bit too complex for gcc to follow here. Moving the intialization of 'index' a little further down makes it clear to gcc that the function always returns an error if it is not initialized. Signed-off-by: Arnd Bergmann --- drivers/net/ethernet/rocker/rocker_ofdpa.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/rocker/rocker_ofdpa.c b/drivers/net/ethernet/rocker/rocker_ofdpa.c index 431a608..4ca4613 100644 --- a/drivers/net/ethernet/rocker/rocker_ofdpa.c +++ b/drivers/net/ethernet/rocker/rocker_ofdpa.c @@ -1493,8 +1493,6 @@ static int ofdpa_port_ipv4_nh(struct ofdpa_port *ofdpa_port, spin_lock_irqsave(&ofdpa->neigh_tbl_lock, lock_flags); found = ofdpa_neigh_tbl_find(ofdpa, ip_addr); - if (found) - *index = found->index; updating = found && adding; removing = found && !adding; @@ -1508,9 +1506,11 @@ static int ofdpa_port_ipv4_nh(struct ofdpa_port *ofdpa_port, resolved = false; } else if (removing) { ofdpa_neigh_del(trans, found); + *index = found->index; } else if (updating) { ofdpa_neigh_update(found, trans, NULL, false); resolved = !is_zero_ether_addr(found->eth_dst); + *index = found->index; } else { err = -ENOENT; } -- 2.9.0