From: Chanwoo Choi Date: Fri, 7 Aug 2020 06:03:47 +0000 (+0900) Subject: pmqos: Fix wrong unlocked issue when pmqos list contains only one scenario X-Git-Tag: submit/tizen/20200810.073747~6 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=37ac960a5cbff46eb5536dfb6bc9c26c9584f58a;p=platform%2Fcore%2Fsystem%2Fpass.git pmqos: Fix wrong unlocked issue when pmqos list contains only one scenario 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 --- diff --git a/src/pmqos/pmqos.c b/src/pmqos/pmqos.c index de1f2a6..e14e882 100644 --- a/src/pmqos/pmqos.c +++ b/src/pmqos/pmqos.c @@ -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 */