提交 c2d06fe3 编写于 作者: Z Zhang Rui 提交者: Len Brown

intel_menlow: don't set max_state a negative value

max_state is unsigned long.
don't set max_state a negative value

Cc : Thomas Sujith <sujith.thomas@intel.com>
Cc : Roel Kluin <roel.kluin@gmail.com>
Signed-off-by: NZhang Rui <rui.zhang@intel.com>
Signed-off-by: NLen Brown <len.brown@intel.com>
上级 2830c9fb
......@@ -71,6 +71,9 @@ static int memory_get_int_max_bandwidth(struct thermal_cooling_device *cdev,
if (ACPI_FAILURE(status))
return -EFAULT;
if (!value)
return -EINVAL;
*max_state = value - 1;
return 0;
}
......@@ -121,7 +124,7 @@ static int memory_set_cur_bandwidth(struct thermal_cooling_device *cdev,
if (memory_get_int_max_bandwidth(cdev, &max_state))
return -EFAULT;
if (max_state < 0 || state > max_state)
if (state > max_state)
return -EINVAL;
arg_list.count = 1;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册