From patchwork Wed Aug 23 14:39:27 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 9917487 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 7436960327 for ; Wed, 23 Aug 2017 14:40:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 66980289A5 for ; Wed, 23 Aug 2017 14:40:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5B3102899D; Wed, 23 Aug 2017 14:40:33 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, RCVD_IN_DNSWL_LOW, RCVD_IN_SORBS_SPAM autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 5FED3289A5 for ; Wed, 23 Aug 2017 14:40:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=QPd5i306wqD1tNN1ujtn5arbqJ94q5XXSaoijtCoOac=; b=IW2 TCnUzmAQmiqR98PB6edQDBXlYnxm7wmK4tWr5DJCk5HNpfeRnpEOiLbOd3nauyP4ZEV1kMlzwtfNi 8JGvgof3uODOOPjILNoKagMFTBujTXEhUO3fQiVTSv5JSLH9Slw+pnoOWaUrIIfEy3aTNn7vphwVx 4HoqCl2ON6wULs3KJ2Agk0sto1Ww3piv8XlOnH6PSYzePdJgnHFqt7mmTWpDzmxs9ceX+0xQEUCMn EWxuphSBqvu7e9+qQN3PLzkIAPNVNM8gXqZ9jeytZiYgN+dVxaN3RLu+zBLYP3YDxhK6DzBSQ9dBC 0NTwftZTkTz9v78qwYtkmLBeV40GNtQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dkWpU-00080O-O8; Wed, 23 Aug 2017 14:40:24 +0000 Received: from mout.kundenserver.de ([212.227.126.134]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dkWpO-00067c-VI for linux-arm-kernel@lists.infradead.org; Wed, 23 Aug 2017 14:40:21 +0000 Received: from wuerfel.lan ([95.208.190.237]) by mrelayeu.kundenserver.de (mreue003 [212.227.15.129]) with ESMTPA (Nemesis) id 0Lvfyq-1dTzSj0XpU-017XWD; Wed, 23 Aug 2017 16:39:41 +0200 From: Arnd Bergmann To: =?UTF-8?q?Emilio=20L=C3=B3pez?= , Michael Turquette , Stephen Boyd , Maxime Ripard , Chen-Yu Tsai Subject: [PATCH] clk: sunxi: fix uninitialized access Date: Wed, 23 Aug 2017 16:39:27 +0200 Message-Id: <20170823143937.2176025-1-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 X-Provags-ID: V03:K0:Bp6luNvKPXxKi2RNhZm4GqWD6Kj0MvSgYiu8inPEbvkgYxNx4F7 EO3KKBuPeiG4xviZz9CoVvVSGX9+EjJMIpRa2cjSc2ThpLn2sme7GOhR8p/fi5l0RvSoi1N p0/3tFbj/8r22ggP9EjOFZV8cbZo80Qadi+w4HXOKYL+zZPq9rhylnHZKaF1YpUkwhwF4o2 r8ga29/cc46vbcqWBiiGA== X-UI-Out-Filterresults: notjunk:1; V01:K0:9hiMxjkyy9o=:c8h6PjN5oiKte4DQarxmbP iV6ddt/6qa9W2hmrKPqUx1nHG/pZDObOfoFSxxV34QR26ZWOTp/vwSndT9F1XptTeGBd1ymHI RNn83/41fgPMhZ+0+eXZxDgZu+JtBQt42f22sL5WZvWZFemf2lTwfcSnmuy6C3DvI/0ZO3kSO NaBn3k7UOktf6uuPKDig2NhTyOtaJFFeeObq/FtnxLJHGye4WFYsYMGytJOUEBEFFcD3yes31 8nYJW08JF3FNgO90hGgNTTQklfxt+OOtYhgYgO0yDqfxHb8bi643aOtJTXR8bntw/yDaK/lmy 4d+lslxSzth01LgYLuaEOBHKD0m8cyWq5O7QTygRghYbZcJggf9bLzxnQd6T2q8tS+TQjDlg4 4elcxD1owB4reroGgCZtbc39lGIiVr0a4IYhbg22ulPkIbJHys1x4NoYtGLMwwNbvErZLf+cw 3WiQrtB9l8qc4aY5fLPOC4bZM+J/rZu5d0vHvo9bhPMlYjrqa68fxH3SsuGrXPESjLDLQPplc P9J3V+7efMi3fjBRxpFAt62rNpFZ4i7eFzvZsa09aVIlPZAxBZ5NuDzGDxaHJkATwz81AqHg5 VGZCOT1j/Wm+xUKJ0YEexDwMZE0XJyz8TUOp7g6f5AynRrhZsPS5bfWuep9JOm5BDGk9buJbb izB800Jhj3yoqkaFL3D8GGMN+nO1t7mhcEP4Yz8pr4jovTtXpWOL5DIHY80cprj6XsKEDlVXF dk7FGonTl0spJgu4sVy1CFUtE3mUjeM+RNSarw== X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170823_074019_422598_1F2AA048 X-CRM114-Status: GOOD ( 10.42 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org, Arnd Bergmann , linux-kernel@vger.kernel.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP gcc-8 reports an uninitialized variable access in a code path that we would see with incorrect DTB input: drivers/clk/sunxi/clk-sun8i-bus-gates.c: In function 'sun8i_h3_bus_gates_init': drivers/clk/sunxi/clk-sun8i-bus-gates.c:85:27: error: 'clk_parent' may be used uninitialized in this function [-Werror=maybe-uninitialized] This works around by skipping invalid input and printing a warning instead if it ever happens. The problem was apparently part of the initiali driver submission, but older compilers don't notice it. Fixes: ab6e23a4e388 ("clk: sunxi: Add H3 clocks support") Signed-off-by: Arnd Bergmann Acked-by: Maxime Ripard --- drivers/clk/sunxi/clk-sun8i-bus-gates.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/clk/sunxi/clk-sun8i-bus-gates.c b/drivers/clk/sunxi/clk-sun8i-bus-gates.c index 63fdb790df29..bee305bdddbe 100644 --- a/drivers/clk/sunxi/clk-sun8i-bus-gates.c +++ b/drivers/clk/sunxi/clk-sun8i-bus-gates.c @@ -78,6 +78,10 @@ static void __init sun8i_h3_bus_gates_init(struct device_node *node) clk_parent = APB1; else if (index >= 96 && index <= 127) clk_parent = APB2; + else { + WARN_ON(true); + continue; + } clk_reg = reg + 4 * (index / 32); clk_bit = index % 32;