PM / QOS: correct the valid range of pm_qos_class
Subsystems (2)
PATCH 1/1 PM / QOS: correct the valid range of pm_qos_class
From: Sahara <[email protected]>
The valid start index for pm_qos_array is not 0 but 1. There is a null_pm_qos at index 0 of pm_qos_array. However, null_pm_qos is not created as misc device so that inclusion of 0 index for checking pm_qos_class especially for file operations is not proper here.
--- kernel/power/qos.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
kernel/power/qos.c +2 -2
@@ -477,7 +477,7 @@ static int find_pm_qos_object_by_minor(int minor) {int pm_qos_class; -for (pm_qos_class =0 ; +for (pm_qos_class =1 ; pm_qos_class <PM_QOS_NUM_CLASSES ; pm_qos_class++) {if (minor == pm_qos_array[pm_qos_class]->pm_qos_power_miscdev.minor)
@@ -491,7 +491,7 @@ static int pm_qos_power_open(struct inode *inode, struct file *filp)long pm_qos_class; pm_qos_class =find_pm_qos_object_by_minor (iminor (inode)); -if (pm_qos_class >=0 ) { +if (pm_qos_class >=1 ) {struct pm_qos_request *req =kzalloc (sizeof (*req),GFP_KERNEL );if (!req)return -ENOMEM ;
Signature · 1 line
1.7.1
Quoted 17 lines · On Wednesday, June 12, 2013 02:53:15 PM [email protected] wrote:
From: Sahara <[email protected]>
The valid start index for
pm_qos_arrayis not 0 but 1. There is anull_pm_qosat index 0 ofpm_qos_array. However,null_pm_qosis not created as misc device so that inclusion of 0 index for checkingpm_qos_classespecially for file operations is not proper here.Signed-off-by Sahara <[email protected]>--- kernel/power/qos.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)kernel/power/qos.c +0
-0
kernel/power/qos.c static int find_pm_qos_object_by_minor(int minor) · line 480
Quoted 5 lines
kernel/power/qos.c +1
-1@@ -477,7 +477,7 @@ static int find_pm_qos_object_by_minor(int minor) {int pm_qos_class; - for (pm_qos_class = 0; + for (pm_qos_class = 1;
While you're at it, can you please use PM_QOS_CPU_DMA_LATENCY instead of 1 here and below?
Rafael
Quoted 13 lines
kernel/power/qos.c +1
-1pm_qos_class < PM_QOS_NUM_CLASSES; pm_qos_class++) {if (minor == pm_qos_array[pm_qos_class]->pm_qos_power_miscdev.minor)@@ -491,7 +491,7 @@ static int pm_qos_power_open(struct inode *inode, struct file *filp)long pm_qos_class; pm_qos_class =find_pm_qos_object_by_minor (iminor (inode)); -if (pm_qos_class >=0 ) { +if (pm_qos_class >=1 ) {struct pm_qos_request *req =kzalloc (sizeof (*req),GFP_KERNEL );if (!req)return -ENOMEM ;
Signature · 2 lines
I speak only for myself. Rafael J. Wysocki, Intel Open Source Technology Center.