From patchwork Thu Jan 24 08:51:22 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 2030021 X-Patchwork-Delegate: rui.zhang@intel.com Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id E3F9B3FDBC for ; Thu, 24 Jan 2013 08:51:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751489Ab3AXIvh (ORCPT ); Thu, 24 Jan 2013 03:51:37 -0500 Received: from aserp1040.oracle.com ([141.146.126.69]:26493 "EHLO aserp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751266Ab3AXIvg (ORCPT ); Thu, 24 Jan 2013 03:51:36 -0500 Received: from acsinet21.oracle.com (acsinet21.oracle.com [141.146.126.237]) by aserp1040.oracle.com (Sentrion-MTA-4.2.2/Sentrion-MTA-4.2.2) with ESMTP id r0O8pVrq026502 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 24 Jan 2013 08:51:31 GMT Received: from acsmt356.oracle.com (acsmt356.oracle.com [141.146.40.156]) by acsinet21.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id r0O8pUtt003405 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 24 Jan 2013 08:51:31 GMT Received: from abhmt119.oracle.com (abhmt119.oracle.com [141.146.116.71]) by acsmt356.oracle.com (8.12.11.20060308/8.12.11) with ESMTP id r0O8pU6g027789; Thu, 24 Jan 2013 02:51:30 -0600 Received: from elgon.mountain (/41.212.103.53) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 24 Jan 2013 00:51:29 -0800 Date: Thu, 24 Jan 2013 11:51:22 +0300 From: Dan Carpenter To: Zhang Rui Cc: linux-pm@vger.kernel.org, Jacob Pan , Arjan van de Ven , kernel-janitors@vger.kernel.org Subject: [patch] PM: intel_powerclamp: off by one in start_power_clamp() Message-ID: <20130124085122.GA3547@elgon.mountain> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <5100ee96.xoiaCavCYxXgoSIK%fengguang.wu@intel.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-Source-IP: acsinet21.oracle.com [141.146.126.237] Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org This value has already been clamped correctly to 0 through 49 in powerclamp_set_cur_state() so this patch doesn't actually change anything. But we should fix it anyway for consistency. set_target_ratio is used as an offset into an array with MAX_TARGET_RATIO (50) elements. Signed-off-by: Dan Carpenter --- 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/thermal/intel_powerclamp.c b/drivers/thermal/intel_powerclamp.c index a85ff38..ab3ed90 100644 --- a/drivers/thermal/intel_powerclamp.c +++ b/drivers/thermal/intel_powerclamp.c @@ -504,7 +504,7 @@ static int start_power_clamp(void) return -EINVAL; } - set_target_ratio = clamp(set_target_ratio, 0U, MAX_TARGET_RATIO); + set_target_ratio = clamp(set_target_ratio, 0U, MAX_TARGET_RATIO - 1); /* prevent cpu hotplug */ get_online_cpus();