From patchwork Mon Jun 13 20:40:36 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 102230 Delivered-To: patch@linaro.org Received: by 10.140.106.246 with SMTP id e109csp1726151qgf; Mon, 13 Jun 2016 13:39:44 -0700 (PDT) X-Received: by 10.36.85.16 with SMTP id e16mr22080237itb.5.1465850384777; Mon, 13 Jun 2016 13:39:44 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o124si34012829pfb.247.2016.06.13.13.39.44; Mon, 13 Jun 2016 13:39:44 -0700 (PDT) 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 S1423141AbcFMUjm (ORCPT + 30 others); Mon, 13 Jun 2016 16:39:42 -0400 Received: from mout.kundenserver.de ([212.227.126.135]:54639 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1161183AbcFMUjl (ORCPT ); Mon, 13 Jun 2016 16:39:41 -0400 Received: from wuerfel.lan. ([78.42.132.4]) by mrelayeu.kundenserver.de (mreue001) with ESMTPA (Nemesis) id 0MazIw-1asGdc2t22-00KM6r; Mon, 13 Jun 2016 22:39:30 +0200 From: Arnd Bergmann To: Daniel Lezcano , Thomas Gleixner Cc: Arnd Bergmann , Florian Fainelli , Ray Jui , Scott Branden , Viresh Kumar , bcm-kernel-feedback-list@broadcom.com, linux-kernel@vger.kernel.org Subject: [PATCH] clocksource: kona: avoid bogus warning Date: Mon, 13 Jun 2016 22:40:36 +0200 Message-Id: <1465850461-3533361-1-git-send-email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-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org I could not figure out why, but gcc cannot prove that the kona_timer_init function always initializes its two outputs, and we get a warning for the use of the 'lsw' variable later, which is obviously correct. drivers/clocksource/bcm_kona_timer.c: In function 'kona_timer_init': drivers/clocksource/bcm_kona_timer.c:119:13: error: 'lsw' may be used uninitialized in this function [-Werror=maybe-uninitialized] Slightly reordering the loop makes the warning disappear, after it becomes more obvious to the compiler that the loop is always entered on the first iteration. Signed-off-by: Arnd Bergmann --- drivers/clocksource/bcm_kona_timer.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) -- 2.7.0 diff --git a/drivers/clocksource/bcm_kona_timer.c b/drivers/clocksource/bcm_kona_timer.c index 70d9c1e482dd..bbbfb03b46dd 100644 --- a/drivers/clocksource/bcm_kona_timer.c +++ b/drivers/clocksource/bcm_kona_timer.c @@ -69,7 +69,7 @@ static void kona_timer_disable_and_clear(void __iomem *base) static void kona_timer_get_counter(void __iomem *timer_base, uint32_t *msw, uint32_t *lsw) { - int loop_limit = 4; + int loop_limit = 3; /* * Read 64-bit free running counter @@ -83,12 +83,12 @@ kona_timer_get_counter(void __iomem *timer_base, uint32_t *msw, uint32_t *lsw) * if new hi-word is equal to previously read hi-word then stop. */ - while (--loop_limit) { + do { *msw = readl(timer_base + KONA_GPTIMER_STCHI_OFFSET); *lsw = readl(timer_base + KONA_GPTIMER_STCLO_OFFSET); if (*msw == readl(timer_base + KONA_GPTIMER_STCHI_OFFSET)) break; - } + } while (--loop_limit); if (!loop_limit) { pr_err("bcm_kona_timer: getting counter failed.\n"); pr_err(" Timer will be impacted\n");