From patchwork Mon Jan 25 15:54:04 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 101115 Delivered-To: patch@linaro.org Received: by 10.112.130.2 with SMTP id oa2csp1439141lbb; Mon, 25 Jan 2016 07:56:42 -0800 (PST) X-Received: by 10.67.6.67 with SMTP id cs3mr26859434pad.143.1453737402715; Mon, 25 Jan 2016 07:56:42 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x16si34478559pfa.181.2016.01.25.07.56.41; Mon, 25 Jan 2016 07:56:42 -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 S932934AbcAYP4k (ORCPT + 30 others); Mon, 25 Jan 2016 10:56:40 -0500 Received: from mout.kundenserver.de ([212.227.126.187]:53164 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933247AbcAYPyv (ORCPT ); Mon, 25 Jan 2016 10:54:51 -0500 Received: from wuerfel.lan. ([78.42.132.4]) by mrelayeu.kundenserver.de (mreue004) with ESMTPA (Nemesis) id 0MDTqb-1aKlJx1E4L-00Gtqi; Mon, 25 Jan 2016 16:54:20 +0100 From: Arnd Bergmann To: Michael Turquette , Stephen Boyd Cc: linux-arm-kernel@lists.infradead.org, Arnd Bergmann , Gabriel Fernandez , Pankaj Dev , linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] clk: st: avoid uninitialized variable use Date: Mon, 25 Jan 2016 16:54:04 +0100 Message-Id: <1453737255-1959849-1-git-send-email-arnd@arndb.de> X-Mailer: git-send-email 2.7.0 X-Provags-ID: V03:K0:He64rfRYxoqFdsJKakZOlduAz5O+1qhFXDUbhfpc2LZUDAC0JK3 DOyZogc6XZSRkEZ6dqArzhxw3PTel7h5WbVop9r6es/8hNbyhrzGDEU/tU1n6u+tSPqTHdz QTW2DInG9L7DjzEsai+caCAz5hF6boyXIqrg1m3MT9bVHby0Z1RSsnHYPaT03eafv/o/tcg 6ang5zTkxmKJdqiDxi4kA== X-UI-Out-Filterresults: notjunk:1; V01:K0:7VmMJME5Lo4=:n4HvS0BG7faTwDRFlrQo7Z CHnStGWM58wZb+fwepdqC93QEQpg6lWCyX9xDRpzSPjsl3jf8za3vndSefiGDqaZxK7QuYtXF 9Ch5TVoidPjb2aUILwKwTOAscSiP3IBfXHSA0dwa2wCkvmeQufuK6obF7r83wtSOVox8YNhi3 c9eBw4Yo8ITqog/nAG8DFNDF4hCJPLxEKtXbXchTz1XYZ4ZzoP8o1lVv1KyAsR26sW1WmwIHv KCI/8GUCQVXDdyS39H0EAGRRVAx36NeHIX024rC4wLKgoVbqAgF9rvjQcSGP0I3jaJteb2aQL WidYUgpmqDiZpKmN/Nymb79o327UPvXYDa7AQdSxSDV7AO70PUVNIh2NVdP/TT4XB0XmpxuSw Fl9+WB3rJ9tr5gSce42QTU89rS8tXPI2XaurVACinygP+Fr1Tz+b9JCaTTZGnqwCOWmZQtFac KCg7bEG+srnS0sfQkceNcHk1GftoePPBL1t31/YaZr92SYtYmNDuwAuUiJEZQJhhfNyDwJo7I TZbWj8rNZJuolHLEDZOeahQH9vvmmGE8oGM4WuOGY6Li/gHubqybuiIQ0O5if7C5e8v4fENLb VI/0MW+V4c42WoDl82OYMoNbyn6WkSyV5/jWFfYHl4ombz4mGZnoGI5Yi4Fb/G7YRgD+Sn8U1 smV1CTCIA77Ke44mlZMP10gbh/77y3vpzwfYbl1t/dQUybeRMucyGFvXKdfvO9Aa1y1I= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org My previous patch fixed some warnings about printing a couple of variables that are always uninitialized in quadfs_pll_fs660c32_set_rate(), but I now got a warning that only shows up in some configurations (i.e. without gcc -Os) about the params.ndiv being used uninitialized in the error case: drivers/clk/st/clkgen-fsyn.c: In function 'quadfs_pll_fs660c32_set_rate': drivers/clk/st/clkgen-fsyn.c:584:75: warning: 'params.ndiv' may be used uninitialized in this function [-Wmaybe-uninitialized] drivers/clk/st/clkgen-fsyn.c:574:16: note: 'params.ndiv' was declared here This changes the error handling so we bail for invalid arguments rather than continuing with uninitialized data. Signed-off-by: Arnd Bergmann --- drivers/clk/st/clkgen-fsyn.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) -- 2.7.0 diff --git a/drivers/clk/st/clkgen-fsyn.c b/drivers/clk/st/clkgen-fsyn.c index ccb324d97160..dec4eaaecc00 100644 --- a/drivers/clk/st/clkgen-fsyn.c +++ b/drivers/clk/st/clkgen-fsyn.c @@ -574,12 +574,16 @@ static int quadfs_pll_fs660c32_set_rate(struct clk_hw *hw, unsigned long rate, struct stm_fs params; long hwrate = 0; unsigned long flags = 0; + int ret; if (!rate || !parent_rate) return -EINVAL; - if (!clk_fs660c32_vco_get_params(parent_rate, rate, ¶ms)) - clk_fs660c32_vco_get_rate(parent_rate, ¶ms, &hwrate); + ret = clk_fs660c32_vco_get_params(parent_rate, rate, ¶ms); + if (ret) + return ret; + + clk_fs660c32_vco_get_rate(parent_rate, ¶ms, &hwrate); pr_debug("%s: %s new rate %ld [ndiv=0x%x]\n", __func__, clk_hw_get_name(hw),