Skip to content

Commit

Permalink
PM: intel_powerclamp: off by one in start_power_clamp()
Browse files Browse the repository at this point in the history
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>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
  • Loading branch information
Dan Carpenter authored and Zhang Rui committed Feb 6, 2013
1 parent 3ad9524 commit c8165dc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/thermal/intel_powerclamp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down

0 comments on commit c8165dc

Please sign in to comment.