From patchwork Mon Jul 31 18:37:28 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthias Kaehlcke X-Patchwork-Id: 9872957 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 D012A602F0 for ; Mon, 31 Jul 2017 18:38:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A45A52851A for ; Mon, 31 Jul 2017 18:38:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 99040285D2; Mon, 31 Jul 2017 18:38:24 +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=-1.4 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, RCVD_IN_DNSWL_NONE, RCVD_IN_SORBS_SPAM autolearn=no 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 1783B285D3 for ; Mon, 31 Jul 2017 18:38:24 +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=eUPeXLpooBwQ/GHcHJR3JHtjTD0+dwj3szeaSgqQDXU=; b=Mqe EeRc1eVMt2zkYPajrHco5ubr/bKKkfnKWoxGwo1N0oCK2rsx9PgKn9kNmJY4OwuQcfistspq0b7rV gBXJDrXH9Kfx2vJEVGGNw5KZ+LjSauPCbUUJT5/dlP8lL3wRzv8pN78pVnHybNR4qiTZTk3mrH2UH uJX/NqsNp7Br5/Qt1TyljQv6hys74w6ogPIlPaS4j9MJlCH91IOyhByPyHmyaRtMyRGPzEDNO4PyK JX/xNUmp2ga2rGIRX7REjXXC6CPldU7H96AJoXTICbD9RriUOHWcnhMxik3igR14j83fks9iE/a6g pOearGWoackCatRMtFuxbLOKxTkAmMg==; 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 1dcFZu-0004FT-1c; Mon, 31 Jul 2017 18:38:06 +0000 Received: from mail-pg0-f43.google.com ([74.125.83.43]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dcFZq-0004Ej-Jb for linux-arm-kernel@lists.infradead.org; Mon, 31 Jul 2017 18:38:04 +0000 Received: by mail-pg0-f43.google.com with SMTP id 125so141658013pgi.3 for ; Mon, 31 Jul 2017 11:37:45 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=San4RbYYq1nPHm33H6kFeK/c22AzCz+4IWSitfjo5Ec=; b=lVQzcUaUB1DmH54XViHPO1DRIjtfz0VC3k4qSZDIp7ML2akYvkCC9+/Cvx/zuMbVi9 TNZED9dkIg+fq187qYptUep5hw6gy+9Nmj2F8DpS+yz+9888bqiIp2rRT7p/le7KrqnD pzoQYyEBAYgZla+UutWDHDFUW5AVor8qhRYWt+/UWiAAswTRuPxhG7eGGRL7848cOdU2 w47x1yYCwQwYNKQ4JGm26YUhexIav7w8Le8xqqHS+BecAvQHwJUtFIpPebsQ8AbP2tIJ frV/5HzyPdn0hEVCt3TC7hwEGQAWfMUrJezhTrQWDUqpR5s9LyiAlTa5eRgrBTil/CSn z8IQ== X-Gm-Message-State: AIVw113o6SC8lnv+6cM6O/Crb3hmEtLxPPQgacyteqlvRItb4fDjcn0l 2PJr6FyyeR2hBGhG X-Received: by 10.84.172.193 with SMTP id n59mr13949102plb.185.1501526264741; Mon, 31 Jul 2017 11:37:44 -0700 (PDT) Received: from mka.mtv.corp.google.com ([172.22.112.49]) by smtp.gmail.com with ESMTPSA id n19sm17291673pfi.35.2017.07.31.11.37.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 31 Jul 2017 11:37:44 -0700 (PDT) From: Matthias Kaehlcke To: Fu Wei , Mark Rutland , Marc Zyngier , Daniel Lezcano , Thomas Gleixner Subject: [PATCH] clocksource: arm_arch_timer: Fix mem frame loop initialization Date: Mon, 31 Jul 2017 11:37:28 -0700 Message-Id: <20170731183728.61087-1-mka@chromium.org> X-Mailer: git-send-email 2.14.0.rc0.400.g1c36432dff-goog X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170731_113802_713473_D1F0F9AE X-CRM114-Status: GOOD ( 11.97 ) 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: Matthias Kaehlcke , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Doug Anderson 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 The loop to find the best memory frame in arch_timer_mem_acpi_init() initializes the loop counter with itself ('i = i'), which is suspicious in the first place and pointed out by clang. The loop condition is 'i < timer_count' and a prior for loop exits when 'i' reaches 'timer_count', therefore the second loop is never executed. Initialize the loop counter with 0 to iterate over all timers, which supposedly was the intention before the typo monster attacked. Fixes: c2743a36765d3 ("clocksource: arm_arch_timer: add GTDT support for memory-mapped timer") Signed-off-by: Matthias Kaehlcke Reported-by: Ard Biesheuvel Acked-by: Mark Rutland --- drivers/clocksource/arm_arch_timer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/clocksource/arm_arch_timer.c b/drivers/clocksource/arm_arch_timer.c index aae87c4c546e..72bbfccef113 100644 --- a/drivers/clocksource/arm_arch_timer.c +++ b/drivers/clocksource/arm_arch_timer.c @@ -1440,7 +1440,7 @@ static int __init arch_timer_mem_acpi_init(int platform_timer_count) * While unlikely, it's theoretically possible that none of the frames * in a timer expose the combination of feature we want. */ - for (i = i; i < timer_count; i++) { + for (i = 0; i < timer_count; i++) { timer = &timers[i]; frame = arch_timer_mem_find_best_frame(timer);