Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932139AbdHWOk2 (ORCPT ); Wed, 23 Aug 2017 10:40:28 -0400 Received: from mout.kundenserver.de ([212.227.126.134]:50081 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754053AbdHWOkY (ORCPT ); Wed, 23 Aug 2017 10:40:24 -0400 From: Arnd Bergmann To: =?UTF-8?q?Emilio=20L=C3=B3pez?= , Michael Turquette , Stephen Boyd , Maxime Ripard , Chen-Yu Tsai Cc: Arnd Bergmann , linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org 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== Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1243 Lines: 33 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 --- 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; -- 2.9.0