pmqos: Fix wrong unlocked issue when pmqos list contains only one scenario 30/240530/1
authorChanwoo Choi <cw00.choi@samsung.com>
Fri, 7 Aug 2020 06:03:47 +0000 (15:03 +0900)
committerChanwoo Choi <cw00.choi@samsung.com>
Fri, 7 Aug 2020 06:37:12 +0000 (15:37 +0900)
The pmqos list contains only one scenario like UltraPowerSaving
and when receiving the unmated scenario name like AppLaunch with unlock info
with that duration is zero, the last scenario will be unlocked.

In order to fix this issuse, correct the conditional statement.

Change-Id: Ica2a3a3f44d02dfd07e3cb57e1dab300decee9d0
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
src/pmqos/pmqos.c

index de1f2a6a7932a2149de7defb8313bab5ccc378fe..e14e88259ae60ed1be16bbf7fb1ae28ff57b6f22 100644 (file)
@@ -332,11 +332,10 @@ static void pmqos_unlock_timeout_update(void)
  */
 static int pmqos_cancel(const char *name)
 {
-       GList *elem;
+       GList *elem = NULL;
        struct pmqos_cpu *cpu;
 
        /* Find previous request */
-       cpu = NULL;
        for (elem = pmqos_head; elem != NULL; elem = elem->next) {
                cpu = elem->data;
                if (!strcmp(cpu->name, name))
@@ -344,7 +343,7 @@ static int pmqos_cancel(const char *name)
        }
 
        /* no cpu */
-       if (!cpu)
+       if (!elem)
                return 0;
 
        /* unlock cpu */