From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964949AbcA1N1q (ORCPT ); Thu, 28 Jan 2016 08:27:46 -0500 Received: from mail-lb0-f175.google.com ([209.85.217.175]:34231 "EHLO mail-lb0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755012AbcA1N1n (ORCPT ); Thu, 28 Jan 2016 08:27:43 -0500 Subject: Re: [PATCH 7/9] net: macb: avoid uninitialized variables To: Arnd Bergmann , "David S. Miller" References: <1453903507-3427225-1-git-send-email-arnd@arndb.de> <1453903507-3427225-8-git-send-email-arnd@arndb.de> Cc: linux-arm-kernel@lists.infradead.org, netdev@vger.kernel.org, Nicolas Ferre , linux-kernel@vger.kernel.org From: Sergei Shtylyov Message-ID: <56AA174C.5010408@cogentembedded.com> Date: Thu, 28 Jan 2016 16:27:40 +0300 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 MIME-Version: 1.0 In-Reply-To: <1453903507-3427225-8-git-send-email-arnd@arndb.de> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello. On 1/27/2016 5:04 PM, Arnd Bergmann wrote: > The macb_clk_init function returns three clock pointers, unless > the it fails to get the first ones. We correctly handle the s/the//. > failure case by propagating the error from macb_probe, but > gcc does not realize this and incorrectly warns about a later > use of those: > > In file included from /git/arm-soc/drivers/net/ethernet/cadence/macb.c:12:0: > drivers/net/ethernet/cadence/macb.c: In function 'macb_probe': Hm, didn't these 2 lines get swapped by chance? > include/linux/clk.h:484:2: error: 'tx_clk' may be used uninitialized in this function [-Werror=maybe-uninitialized] > clk_disable(clk); > ^ > drivers/net/ethernet/cadence/macb.c:2822:28: note: 'tx_clk' was declared here > struct clk *pclk, *hclk, *tx_clk; > ^ > In file included from /git/arm-soc/drivers/net/ethernet/cadence/macb.c:12:0: > include/linux/clk.h:484:2: error: 'hclk' may be used uninitialized in this function [-Werror=maybe-uninitialized] > clk_disable(clk); > ^ > drivers/net/ethernet/cadence/macb.c:2822:21: note: 'hclk' was declared here > struct clk *pclk, *hclk, *tx_clk; > ^ > > This shuts up the misleading warnings by ensuring that the > macb_clk_init() always stores something into all three pointers. > > Signed-off-by: Arnd Bergmann [...] MBR, Sergei