From patchwork Fri Aug 11 14:17:37 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 109877 Delivered-To: patch@linaro.org Received: by 10.140.95.78 with SMTP id h72csp975751qge; Fri, 11 Aug 2017 07:18:45 -0700 (PDT) X-Received: by 10.101.88.130 with SMTP id d2mr15957367pgu.131.1502461125367; Fri, 11 Aug 2017 07:18:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1502461125; cv=none; d=google.com; s=arc-20160816; b=uRPLm3xTsDSGQ8tKwSfC+4eE1dTnuWNM3X9l5vWCIVJzVR42L1LseAg39pwf27T4Sc C2R9wpJ/Kl79lm6VLNl+UYK9Mc/thpe+V/iffV4t9Ra0is7MKJm1fNbcHcusnI1JpJGs EwjvPB3dwcjI5lA4++x2Br/LF7oWHzWCaKKpEcFilu87jcgb9+8yqYZq1slVjhyKWcrP xk0fH86JX0QmmDPhzvzhPIcxckMvfO7e2eR+QWH0qMt5DrHMQVaeUZTfSEm5Q/fPQY6y /xyFd1U3Ij297jq1PP6Xz/bh97yz+rP8QDoJQ3QKKghFhfd6RGRPmUeClOAAw3OgWj4z Nm2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=ZEBSzxresO3yCQPbIls58geWaHdWCqoKlghrtZ/IdQ4=; b=ABiE9JsIeG5j/svFjVHh9QwXqkzPWgrgbDy5GhRpDyFdXTeDF6xBJOiPCDu0A2PNOT alOJ2NAY8Eh7PO/cLVEjEHPeVeIGFGiTRp1WVlhz4Yv+QWuOdyHO+T4PIqrX02/5l3zN 3YjN6aCbTOO+G+bugRW6rM5Wl0gRDu36wkuGAoGdbzW2HXHy1wSDvSeLipVymPUZ2SdH kYNpZJyqpttvvBuhMZ77TAI1akeuxtcrBXYyruCR/eyLPYEYprEbIZ5ynB8ENxv8CHMy e9VijZzkKyvRPYv4gjZ4YDDtx51PS9mmUiIj4BzrIYbbj1vPuK22BMNHSaHcbmZbu4PQ /DCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QgpuB5MK; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q5si593288pfb.4.2017.08.11.07.18.45; Fri, 11 Aug 2017 07:18:45 -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; dkim=pass header.i=@linaro.org header.s=google header.b=QgpuB5MK; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752939AbdHKOSm (ORCPT + 25 others); Fri, 11 Aug 2017 10:18:42 -0400 Received: from mail-wr0-f180.google.com ([209.85.128.180]:36065 "EHLO mail-wr0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752723AbdHKOSk (ORCPT ); Fri, 11 Aug 2017 10:18:40 -0400 Received: by mail-wr0-f180.google.com with SMTP id y43so13957665wrd.3 for ; Fri, 11 Aug 2017 07:18:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=ZEBSzxresO3yCQPbIls58geWaHdWCqoKlghrtZ/IdQ4=; b=QgpuB5MKCyJxx+Aak6EDjTl9DS55oPpALLSK/ohe4OMbbS/HrgCy1BdzxA5EBGDH5+ ZzdT5W0rN+WnNkii7HNeCR4dpUyvi9Y/oknf6ML4E3QE7WcuOw8bKRvcvY82PaMHMYOh tBV+cfz2PZnwkyC/n48/YvQfBmEVfPLb/bUfo= 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:in-reply-to :references; bh=ZEBSzxresO3yCQPbIls58geWaHdWCqoKlghrtZ/IdQ4=; b=a+fDVd4wGTrh2mCYQnTBNkeClyq5/XfJquPopCnNALX4wVWBE91Z4XOlpoV1KQT7Sp m2zbusC3Gbp/XfBWb2cY6kSmaJYeekV215eod3Bqe8olr/myKE2JfFZRzKVGjwPnFgtj BLOxsRP911H30nZa9S99dK84pZh5Io9hoCsJtoASIrIBAPBu7rLyvHN5J9FqVIn6Ux5B 1MKzk9P4MVXeAsbuYsTX1wzvGA4r1qW74cEJM4ZxPin1FF3/7Pks62/cUE+TTJD6A9pp kh045bObLDGeJupeFRgXjSRbzYizSdBn9YYU2bR2jr5xk0l6E9imJXsdox3tscChD6zY /GkQ== X-Gm-Message-State: AHYfb5jNxRU3hdaoG2lODcIcEaUdoW16q7hfMyFVB3aF3gpOiJahFV1T cxnMwMi46P1seapI X-Received: by 10.223.138.167 with SMTP id y36mr11983135wry.176.1502461119447; Fri, 11 Aug 2017 07:18:39 -0700 (PDT) Received: from localhost.localdomain ([2a01:e35:879a:6cd0:e0e8:7a5e:bd6d:f842]) by smtp.gmail.com with ESMTPSA id v22sm868383wra.70.2017.08.11.07.18.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 11 Aug 2017 07:18:38 -0700 (PDT) From: Daniel Lezcano To: tglx@linutronix.de, mingo@kernel.org Cc: dingtianhong@huawei.com, matt.redfearn@imgtec.com, dan.carpenter@oracle.com, garsilva@embeddedor.com, mka@chromium.org, linux-kernel@vger.kernel.org, Mark Rutland , Ard Biesheuvel , Marc Zyngier , linux-arm-kernel@lists.infradead.org (moderated list:ARM ARCHITECTED TIMER DRIVER) Subject: [PATCH 1/5] clocksource/drivers/arm_arch_timer: Fix mem frame loop initialization Date: Fri, 11 Aug 2017 16:17:37 +0200 Message-Id: <1502461061-28065-1-git-send-email-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <20170811141520.GA795@mai> References: <20170811141520.GA795@mai> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Matthias Kaehlcke 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 Signed-off-by: Daniel Lezcano --- drivers/clocksource/arm_arch_timer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.7.4 diff --git a/drivers/clocksource/arm_arch_timer.c b/drivers/clocksource/arm_arch_timer.c index aae87c4..72bbfcc 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);