From patchwork Thu Oct 15 13:32:45 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pawel Moll X-Patchwork-Id: 55017 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f197.google.com (mail-wi0-f197.google.com [209.85.212.197]) by patches.linaro.org (Postfix) with ESMTPS id 48EEC22FFA for ; Thu, 15 Oct 2015 13:43:12 +0000 (UTC) Received: by wicgb1 with SMTP id gb1sf9920869wic.3 for ; Thu, 15 Oct 2015 06:43:11 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:subject:date:message-id :in-reply-to:references:precedence:list-id:list-unsubscribe :list-archive:list-post:list-help:list-subscribe:cc:mime-version :content-type:content-transfer-encoding:sender:errors-to :x-original-sender:x-original-authentication-results:mailing-list; bh=xNzIi+T8Z/Xsty+fy56K+Sv/BcXdsrhBBcJTDeN9ou0=; b=l9S0IN079wcuXr8Yv5CIUuG3dtfZTt8DYqFv+fLE15BQtn7Y+vPR1n+mf8nj6DonwF yu8CzbHbbHXB13ZAk7vO6UUQpB+BI1rQb7eOm4rTnBipV4sA2+NlzLkBTEONXHiBaHtO 67EoLsJGwtGlc5v6J6IqyPTNBxbT5/TH7NGV5cqbw6IvIpmFsiyAe4Nivog0xsAYlwzT ulstfK8H53tX4Y6tB6rZpmxvxoKmSNSwxOQ52T9WQyN5XYddC5JXe7sM6FLTeZw1ewig PGVJH/tObQBg+xJ0CMwsPmuNxypNz2lnIbUz2aMEIGgrZ7lZ/sGBmeYRI3rZbcK3D/ap 98sQ== X-Gm-Message-State: ALoCoQlUY5oywuJdqccuAGSJVCUFaNPqzr1ix+xXocmXEzy2OlXIKabeds1tTZfYMdnCIso4RDLf X-Received: by 10.112.14.4 with SMTP id l4mr234665lbc.20.1444916591375; Thu, 15 Oct 2015 06:43:11 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.25.166.200 with SMTP id p191ls146378lfe.37.gmail; Thu, 15 Oct 2015 06:43:11 -0700 (PDT) X-Received: by 10.112.161.201 with SMTP id xu9mr4608500lbb.10.1444916591238; Thu, 15 Oct 2015 06:43:11 -0700 (PDT) Received: from mail-lf0-f42.google.com (mail-lf0-f42.google.com. [209.85.215.42]) by mx.google.com with ESMTPS id ta8si9178468lbb.115.2015.10.15.06.43.11 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 15 Oct 2015 06:43:11 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.42 as permitted sender) client-ip=209.85.215.42; Received: by lfeh64 with SMTP id h64so27664747lfe.3 for ; Thu, 15 Oct 2015 06:43:11 -0700 (PDT) X-Received: by 10.25.28.73 with SMTP id c70mr2446539lfc.76.1444916591058; Thu, 15 Oct 2015 06:43:11 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.59.35 with SMTP id w3csp642546lbq; Thu, 15 Oct 2015 06:43:10 -0700 (PDT) X-Received: by 10.66.191.131 with SMTP id gy3mr9905055pac.113.1444916590102; Thu, 15 Oct 2015 06:43:10 -0700 (PDT) Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id hw8si21748206pac.167.2015.10.15.06.43.09 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 15 Oct 2015 06:43:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) client-ip=2001:1868:205::9; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZminF-0005C1-K9; Thu, 15 Oct 2015 13:42:05 +0000 Received: from foss.arm.com ([217.140.101.70]) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Zmimy-0004ve-1L for linux-arm-kernel@lists.infradead.org; Thu, 15 Oct 2015 13:41:48 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 5B43049; Thu, 15 Oct 2015 06:32:56 -0700 (PDT) Received: from hornet.cambridge.arm.com (hornet.cambridge.arm.com [10.2.206.63]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 943A53F49B; Thu, 15 Oct 2015 06:32:58 -0700 (PDT) From: Pawel Moll To: arm@kernel.org Subject: [PATCH 1/2] bus: arm-ccn: Handle correctly no-more-cpus case Date: Thu, 15 Oct 2015 14:32:45 +0100 Message-Id: <1444915966-8055-2-git-send-email-pawel.moll@arm.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1444915966-8055-1-git-send-email-pawel.moll@arm.com> References: <1444915966-8055-1-git-send-email-pawel.moll@arm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20151015_064148_101153_3234E583 X-CRM114-Status: UNSURE ( 8.63 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -6.9 (------) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-6.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at http://www.dnswl.org/, high trust [217.140.101.70 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , Cc: Pawel Moll , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: pawel.moll@arm.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.42 as permitted sender) smtp.mailfrom=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 When migrating events the driver picks another cpu using cpumask_any_but() function, which returns value >= nr_cpu_ids when there is none available, not a negative value as the code assumed. Fixed now. Reported-by: Dan Carpenter Signed-off-by: Pawel Moll --- drivers/bus/arm-ccn.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/bus/arm-ccn.c b/drivers/bus/arm-ccn.c index 7d9879e..cc322fb 100644 --- a/drivers/bus/arm-ccn.c +++ b/drivers/bus/arm-ccn.c @@ -1184,7 +1184,7 @@ static int arm_ccn_pmu_cpu_notifier(struct notifier_block *nb, if (!cpumask_test_and_clear_cpu(cpu, &dt->cpu)) break; target = cpumask_any_but(cpu_online_mask, cpu); - if (target < 0) + if (target >= nr_cpu_ids) break; perf_pmu_migrate_context(&dt->pmu, cpu, target); cpumask_set_cpu(target, &dt->cpu);