All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Zhang Rui <rui.zhang@intel.com>
Cc: linux-pm@vger.kernel.org,
	Jacob Pan <jacob.jun.pan@linux.intel.com>,
	Arjan van de Ven <arjan@linux.intel.com>,
	kernel-janitors@vger.kernel.org
Subject: [patch] PM: intel_powerclamp: off by one in start_power_clamp()
Date: Thu, 24 Jan 2013 08:51:22 +0000	[thread overview]
Message-ID: <20130124085122.GA3547@elgon.mountain> (raw)
In-Reply-To: <5100ee96.xoiaCavCYxXgoSIK%fengguang.wu@intel.com>

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 <dan.carpenter@oracle.com>

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();
 

WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Zhang Rui <rui.zhang@intel.com>
Cc: linux-pm@vger.kernel.org,
	Jacob Pan <jacob.jun.pan@linux.intel.com>,
	Arjan van de Ven <arjan@linux.intel.com>,
	kernel-janitors@vger.kernel.org
Subject: [patch] PM: intel_powerclamp: off by one in start_power_clamp()
Date: Thu, 24 Jan 2013 11:51:22 +0300	[thread overview]
Message-ID: <20130124085122.GA3547@elgon.mountain> (raw)
In-Reply-To: <5100ee96.xoiaCavCYxXgoSIK%fengguang.wu@intel.com>

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 <dan.carpenter@oracle.com>

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();
 

       reply	other threads:[~2013-01-24  8:51 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <5100ee96.xoiaCavCYxXgoSIK%fengguang.wu@intel.com>
2013-01-24  8:51 ` Dan Carpenter [this message]
2013-01-24  8:51   ` [patch] PM: intel_powerclamp: off by one in start_power_clamp() Dan Carpenter
2013-02-04  1:44   ` Zhang Rui
2013-02-04  1:44     ` Zhang Rui

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130124085122.GA3547@elgon.mountain \
    --to=dan.carpenter@oracle.com \
    --cc=arjan@linux.intel.com \
    --cc=jacob.jun.pan@linux.intel.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=rui.zhang@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.