From patchwork Wed Jan 27 14:04:57 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 101051 Delivered-To: patch@linaro.org Received: by 10.112.130.2 with SMTP id oa2csp2603122lbb; Wed, 27 Jan 2016 06:08:11 -0800 (PST) X-Received: by 10.66.164.102 with SMTP id yp6mr42093177pab.25.1453903691196; Wed, 27 Jan 2016 06:08:11 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ui8si9344755pab.38.2016.01.27.06.08.10; Wed, 27 Jan 2016 06:08:11 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933030AbcA0OIF (ORCPT + 30 others); Wed, 27 Jan 2016 09:08:05 -0500 Received: from mout.kundenserver.de ([212.227.126.187]:62738 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932971AbcA0OH7 (ORCPT ); Wed, 27 Jan 2016 09:07:59 -0500 Received: from wuerfel.lan. ([78.42.132.4]) by mrelayeu.kundenserver.de (mreue002) with ESMTPA (Nemesis) id 0MLWss-1aOyib2WR8-000YsD; Wed, 27 Jan 2016 15:07:27 +0100 From: Arnd Bergmann To: "David S. Miller" Cc: linux-arm-kernel@lists.infradead.org, Arnd Bergmann , netdev@vger.kernel.org, Nicolas Ferre , linux-kernel@vger.kernel.org Subject: [PATCH 7/9] net: macb: avoid uninitialized variables Date: Wed, 27 Jan 2016 15:04:57 +0100 Message-Id: <1453903507-3427225-8-git-send-email-arnd@arndb.de> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1453903507-3427225-1-git-send-email-arnd@arndb.de> References: <1453903507-3427225-1-git-send-email-arnd@arndb.de> X-Provags-ID: V03:K0:pWLipCgDndAP7lGoFNJPGyTxAdbvZi5SzmN1XcLd8TmcWNMqIsT pwImpmNJJSwTB/RIBU9XdOlDBgrA3BEVf4MO50WpRbqhTLmi1i3W55KVTK47rwC0xYinioz TRI2kTEEvyLbs8OSrPY9tam/BavU+hHDrh8aGwfHGmXhyE06J5RQtVXI8yTrNGLqPsFUHJB ym/7+M19NnRN7KQwcR0Hg== X-UI-Out-Filterresults: notjunk:1; V01:K0:HPE7fHPqAA0=:nkVXeLGHde3G/IzlKlGeen lU2NfbK9mgmtYl0b/4L35hwyUk1EuVLaNWyXeB3TD6e2VkBdTeqG/WWnsTeUpS7UOEe74X7Cx U6LqC1/daU5DqyR7iC0Tot9HQQPtxxArkq3MUmY40FOUswVGh5AP/mUO1xFOarRU1uDBk/2S5 GqRln15m1NYZj4fkDlCxr+Xz4a01uW+GVRRlTjr/r0PHLHgZH1gkFOafr41oq6mUZzvRxBhX+ CmCSwL4Dp4gMfIJjPvnPljKkH+McKB0nIq9xPcxcjDNWX10ZvzcKDk+SsYnmXlhjP/MO8wwVW 4EEab3NamfMLd1y1+DbHGNG65MQuJYIWQ5oi0rBiTOuwxZb4ekj/2gES0YUdvZCTyZeWsVkm1 eYpxShvRjXihpufbF2wMT90QHZvfKpfD6qXTjmrYTx/kDOfBMhTkstKLEnzrjnxUubV3Vqfs9 cEPKtyjZo1A43YcngAK+rWrsNyh6m64zZ6vhFHUrrmgVb2WtgNKf8yE8R6NfTH9cJd+VoKWBw yUo5RMjV2yoHvI0XwFlQcTU2jVUFJ0ASDf4dB1bKrUZOzQ69hBcnloNOBoIE0QIamP1al0aXy qDNp97t0Yk2ySlORTQ7+dsFjasxokY/dGzVZAWDO7fj0ptE6Ffo90j24lEIOfPTiwy6Zti/4W /IS01k9PhvSV895aidXAZmHYECVgzMrnTI6g0dU6+NXTq77iQXMzU4wxHt/OGk62kDzg= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The macb_clk_init function returns three clock pointers, unless the it fails to get the first ones. We correctly handle 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': 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 --- drivers/net/ethernet/cadence/macb.c | 1 + 1 file changed, 1 insertion(+) -- 2.7.0 Acked-by: Nicolas Ferre diff --git a/drivers/net/ethernet/cadence/macb.c b/drivers/net/ethernet/cadence/macb.c index 9d9984a87d42..d3aa74f9db79 100644 --- a/drivers/net/ethernet/cadence/macb.c +++ b/drivers/net/ethernet/cadence/macb.c @@ -2268,6 +2268,7 @@ static int macb_clk_init(struct platform_device *pdev, struct clk **pclk, { int err; + *tx_clk = *hclk = NULL; *pclk = devm_clk_get(&pdev->dev, "pclk"); if (IS_ERR(*pclk)) { err = PTR_ERR(*pclk);