From patchwork Fri Feb 16 15:27:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 10224971 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 CC5C5602CB for ; Fri, 16 Feb 2018 15:28:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BD35A29513 for ; Fri, 16 Feb 2018 15:28:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B066829514; Fri, 16 Feb 2018 15:28:34 +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=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4797028956 for ; Fri, 16 Feb 2018 15:28:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1030273AbeBPP2T (ORCPT ); Fri, 16 Feb 2018 10:28:19 -0500 Received: from mout.kundenserver.de ([212.227.126.135]:38491 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1030266AbeBPP2R (ORCPT ); Fri, 16 Feb 2018 10:28:17 -0500 Received: from wuerfel.lan ([95.208.111.237]) by mrelayeu.kundenserver.de (mreue001 [212.227.15.129]) with ESMTPA (Nemesis) id 0MHQEF-1ezaFG2jdT-00E7M6; Fri, 16 Feb 2018 16:28:09 +0100 From: Arnd Bergmann To: Geert Uytterhoeven , Michael Turquette , Stephen Boyd Cc: Arnd Bergmann , stable@vger.kernel.org, Andi Kleen , linux-renesas-soc@vger.kernel.org, linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] clk: fix false-positive Wmaybe-uninitialized warning Date: Fri, 16 Feb 2018 16:27:47 +0100 Message-Id: <20180216152807.1629038-1-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 X-Provags-ID: V03:K0:iyeRScIsRZi3vjs/r63vmKfKEw2frPNzKJNNqp7CYyFbeikwvaQ AeLiS+KmOY6f2us7oV8cgCj7vJvSylqLgMzWIKE/82az7OoVNZIaAopfxVyW0C544QsuzVR PkrB7ydPw33c1VCuSrVjIhp/qnzArdzl9epu8KU24PHMagNOG10oSnUpVpQcKZxkICkiAcy 5p2HxkvDxTCbSo0w2ZfQQ== X-UI-Out-Filterresults: notjunk:1; V01:K0:14G+KML9F6A=:s0AfaDwiN+uxF0LriP3hiy RfaAU/mzWR4FvjDFU6cbZxdqWDnbTfEBr6Zz/51EyknUy1ymU6HkzFzyQj8DdMme6bxPniGvA Jp0WklubgX8BX5O2Yk2rTNy8cd00BsN5oC6fLPwqyyWSRuJkNFNiFoJztC+5UCvb6uXI3aPTV n/mz282oDzkDmsjx1pZUJnNfyGQ/y/ZSOipd7313z8+EYk0Ivhx/XUg1X7eC0tV4DM8NFE0kR VSdNN0bcRLDHXR12A3Gu2B2c2uhbBtG9fvzWtY/JriUmOh7tKdSEyTBs1l0PijYXpuBqOIVq9 bGlRdpDpmqQxZZ8VtmRv/6q4jIXnNEfw6jYli6W3diiBKFg9mrZgdW+aa1GWen0A34VYhTQNx 1gQKO/nP5tKhx2wljpAOw68tXDQfSe6pL+LZlhqtZxH+z3qght+KHvP0ifyEEAcPsPA5UI6vh lKtK2fMDKaiARJukvJJeleWeveSjX8Vv9Js86+OuiYO/Au4LErtLyefTpuOVdD3bpmAlEb2ng 5wr/0j7+bWBgAMHqcDAM+he1P0kTnOWOM1JLLifWFa+qiBgxQxqdx/a4KpOgRYoF4SQFkbkfK uAnv+5quTSqp0cLgzCIoa15LpImeZxZyZ9kx0ty1oe7HQWMWODTl5188Gh+3nyFtzn18S4q+Q m8dHoG5L/Fvcc8TQMYa4OMRRe+7JwgBWBIWtBox1UdCuroa/3ayPUH5NK1e5aK/fYou2Q35a0 j3Jxotfw5kr6jxbDhbWGUOlwW01dsosXexAVmg== Sender: linux-clk-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-clk@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP When we build this driver with on x86-32, gcc produces a false-positive warning: drivers/clk/renesas/clk-sh73a0.c: In function 'sh73a0_cpg_clocks_init': drivers/clk/renesas/clk-sh73a0.c:155:10: error: 'parent_name' may be used uninitialized in this function [-Werror=maybe-uninitialized] return clk_register_fixed_factor(NULL, name, parent_name, 0, We can work around that warning by adding a fake initialization, I tried and failed to come up with any better workaround. This is currently one of few remaining warnings for a 4.14.y randconfig build, so it would be good to also have it backported at least to that version. Older versions have more randconfig warnings, so we might not care. I had not noticed this earlier, because one patch in my randconfig test tree removes the '-ffreestanding' option on x86-32, and that avoids the warning. The -ffreestanding flag was originally global but moved into arch/i386 by Andi Kleen in commit 6edfba1b33c7 ("[PATCH] x86_64: Don't define string functions to builtin") as a 'temporary workaround'. Like many temporary hacks, this turned out to be rather long-lived, from all I can tell we still need a simple fix to asm/string_32.h before it can be removed, but I'm not sure about how to best do that. Cc: stable@vger.kernel.org Cc: Andi Kleen Signed-off-by: Arnd Bergmann Acked-by: Geert Uytterhoeven --- drivers/clk/renesas/clk-sh73a0.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/clk/renesas/clk-sh73a0.c b/drivers/clk/renesas/clk-sh73a0.c index eea38f6ea77e..3892346c4fcc 100644 --- a/drivers/clk/renesas/clk-sh73a0.c +++ b/drivers/clk/renesas/clk-sh73a0.c @@ -46,7 +46,7 @@ struct div4_clk { unsigned int shift; }; -static struct div4_clk div4_clks[] = { +static const struct div4_clk div4_clks[] = { { "zg", "pll0", CPG_FRQCRA, 16 }, { "m3", "pll1", CPG_FRQCRA, 12 }, { "b", "pll1", CPG_FRQCRA, 8 }, @@ -79,7 +79,7 @@ sh73a0_cpg_register_clock(struct device_node *np, struct sh73a0_cpg *cpg, { const struct clk_div_table *table = NULL; unsigned int shift, reg, width; - const char *parent_name; + const char *parent_name = NULL; unsigned int mult = 1; unsigned int div = 1; @@ -135,7 +135,7 @@ sh73a0_cpg_register_clock(struct device_node *np, struct sh73a0_cpg *cpg, shift = 24; width = 5; } else { - struct div4_clk *c; + const struct div4_clk *c; for (c = div4_clks; c->name; c++) { if (!strcmp(name, c->name)) {