pass: cpuhp: Remove possible null deference 21/172221/1 accepted/tizen/unified/20180313.061035 submit/tizen/20180313.020130
authorSeung-Woo Kim <sw0312.kim@samsung.com>
Tue, 13 Mar 2018 01:49:02 +0000 (10:49 +0900)
committerSeung-Woo Kim <sw0312.kim@samsung.com>
Tue, 13 Mar 2018 01:49:04 +0000 (10:49 +0900)
From cpuhp_governor_timer_cb(), it checks null value of res after
deference it. Remove the possible null deference.

Change-Id: I236d93ec9829f4019fd25f7d6f16fa2d77f6761e
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
src/pass/pass-cpuhp.c

index a863ad60e60ac11521836c0bd54728b231a22276..38174a47f4868e0267aacb0509ac678ec09a2546 100644 (file)
@@ -167,8 +167,8 @@ static void cpuhp_calculate_busy_cpu(struct pass_resource *res)
 static gboolean cpuhp_governor_timer_cb(gpointer data)
 {
        struct pass_resource *res = (struct pass_resource *)data;
-       struct pass_level *levels = res->config_data.levels;
-       struct pass_cpuhp *cpuhp = &res->cpuhp;
+       struct pass_level *levels;
+       struct pass_cpuhp *cpuhp;
        static int count = 0;
        double curr_gov_timeout, next_gov_timeout;
        int level, ret;
@@ -178,6 +178,9 @@ static gboolean cpuhp_governor_timer_cb(gpointer data)
                return FALSE;
        }
 
+       levels = res->config_data.levels;
+       cpuhp = &res->cpuhp;
+
        /*
         * Collect data related to system state
         * - the current frequency