All of lore.kernel.org
 help / color / mirror / Atom feed
* [patch] PM: intel_powerclamp: off by one in start_power_clamp()
       [not found] <5100ee96.xoiaCavCYxXgoSIK%fengguang.wu@intel.com>
@ 2013-01-24  8:51   ` Dan Carpenter
  0 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2013-01-24  8:51 UTC (permalink / raw)
  To: Zhang Rui; +Cc: linux-pm, Jacob Pan, Arjan van de Ven, kernel-janitors

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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [patch] PM: intel_powerclamp: off by one in start_power_clamp()
@ 2013-01-24  8:51   ` Dan Carpenter
  0 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2013-01-24  8:51 UTC (permalink / raw)
  To: Zhang Rui; +Cc: linux-pm, Jacob Pan, Arjan van de Ven, kernel-janitors

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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [patch] PM: intel_powerclamp: off by one in start_power_clamp()
  2013-01-24  8:51   ` Dan Carpenter
@ 2013-02-04  1:44     ` Zhang Rui
  -1 siblings, 0 replies; 4+ messages in thread
From: Zhang Rui @ 2013-02-04  1:44 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: linux-pm, Jacob Pan, Arjan van de Ven, kernel-janitors

On Thu, 2013-01-24 at 11:51 +0300, Dan Carpenter wrote:
> 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>

applied to thermal-next.

BTW, Jacob, it would be good to get your comments on this as you're the
author of this driver.

thanks,
rui
> 
> 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();
>  



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [patch] PM: intel_powerclamp: off by one in start_power_clamp()
@ 2013-02-04  1:44     ` Zhang Rui
  0 siblings, 0 replies; 4+ messages in thread
From: Zhang Rui @ 2013-02-04  1:44 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: linux-pm, Jacob Pan, Arjan van de Ven, kernel-janitors

On Thu, 2013-01-24 at 11:51 +0300, Dan Carpenter wrote:
> 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>

applied to thermal-next.

BTW, Jacob, it would be good to get your comments on this as you're the
author of this driver.

thanks,
rui
> 
> 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();
>  



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-02-04  1:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <5100ee96.xoiaCavCYxXgoSIK%fengguang.wu@intel.com>
2013-01-24  8:51 ` [patch] PM: intel_powerclamp: off by one in start_power_clamp() Dan Carpenter
2013-01-24  8:51   ` Dan Carpenter
2013-02-04  1:44   ` Zhang Rui
2013-02-04  1:44     ` Zhang Rui

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.