From patchwork Mon Apr 28 18:54:27 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Srivatsa S. Bhat" X-Patchwork-Id: 4080901 Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 9DB0F9F169 for ; Mon, 28 Apr 2014 19:27:54 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C8F7920117 for ; Mon, 28 Apr 2014 19:27:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CE57A20179 for ; Mon, 28 Apr 2014 19:27:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932473AbaD1TZe (ORCPT ); Mon, 28 Apr 2014 15:25:34 -0400 Received: from e28smtp09.in.ibm.com ([122.248.162.9]:38928 "EHLO e28smtp09.in.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932652AbaD1TZb (ORCPT ); Mon, 28 Apr 2014 15:25:31 -0400 Received: from /spool/local by e28smtp09.in.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 29 Apr 2014 00:25:16 +0530 Received: from d28dlp01.in.ibm.com (9.184.220.126) by e28smtp09.in.ibm.com (192.168.1.139) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 29 Apr 2014 00:25:14 +0530 Received: from d28relay01.in.ibm.com (d28relay01.in.ibm.com [9.184.220.58]) by d28dlp01.in.ibm.com (Postfix) with ESMTP id 5B369E0044; Tue, 29 Apr 2014 00:25:32 +0530 (IST) Received: from d28av01.in.ibm.com (d28av01.in.ibm.com [9.184.220.63]) by d28relay01.in.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id s3SIt8Ml49938440; Tue, 29 Apr 2014 00:25:08 +0530 Received: from d28av01.in.ibm.com (localhost [127.0.0.1]) by d28av01.in.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id s3SItDbb003142; Tue, 29 Apr 2014 00:25:13 +0530 Received: from srivatsabhat.in.ibm.com ([9.79.235.252]) by d28av01.in.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id s3SItBR1003087; Tue, 29 Apr 2014 00:25:12 +0530 From: "Srivatsa S. Bhat" Subject: [PATCH v2 2/5] cpufreq, powernow-k6: Fix incorrect comparison with max_multipler To: rjw@rjwysocki.net, mroos@linux.ee, viresh.kumar@linaro.org Cc: cpufreq@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, srivatsa.bhat@linux.vnet.ibm.com Date: Tue, 29 Apr 2014 00:24:27 +0530 Message-ID: <20140428185418.28755.68864.stgit@srivatsabhat.in.ibm.com> In-Reply-To: <20140428185331.28755.899.stgit@srivatsabhat.in.ibm.com> References: <20140428185331.28755.899.stgit@srivatsabhat.in.ibm.com> User-Agent: StGIT/0.14.3 MIME-Version: 1.0 X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 14042818-2674-0000-0000-00000E035F10 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The value of 'max_multiplier' is meant to be used for comparison with clock_ratio[index].driver_data, not the index itself! Fix the code in powernow_k6_cpu_exit() that has this bug. Also, while at it, make the for-loop condition look for CPUFREQ_TABLE_END, instead of hard-coding the loop count to 8. Reported-by: Viresh Kumar Signed-off-by: Srivatsa S. Bhat Acked-by: Viresh Kumar --- drivers/cpufreq/powernow-k6.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-pm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/cpufreq/powernow-k6.c b/drivers/cpufreq/powernow-k6.c index 49f120e..695a68c 100644 --- a/drivers/cpufreq/powernow-k6.c +++ b/drivers/cpufreq/powernow-k6.c @@ -227,8 +227,9 @@ have_busfreq: static int powernow_k6_cpu_exit(struct cpufreq_policy *policy) { unsigned int i; - for (i = 0; i < 8; i++) { - if (i == max_multiplier) + + for (i = 0; (clock_ratio[i].frequency != CPUFREQ_TABLE_END); i++) { + if (clock_ratio[i].driver_data == max_multiplier) powernow_k6_target(policy, i); } return 0;