samsung: emc: fix bug that return wrong pointer of head list
authorYoungtae Lee <yt0729.lee@samsung.com>
Fri, 4 May 2018 01:26:58 +0000 (10:26 +0900)
committerlakkyung.jung <lakkyung.jung@samsung.com>
Mon, 23 Jul 2018 05:59:13 +0000 (14:59 +0900)
Change-Id: I6ebfa125f5c60255dfcfc6cfe10510e273246559
Signed-off-by: Youngtae Lee <yt0729.lee@samsung.com>
drivers/soc/samsung/exynos-emc.c

index 7af21c82f09b4b712935f8f2e2e5d1feed98ae13..55ca20125f804245ca0092d76383058e40ee32f8 100644 (file)
@@ -420,7 +420,7 @@ static bool emc_has_boostable_cpu(void)
 
 static struct emc_mode* emc_select_mode(void)
 {
-       struct emc_mode *mode;
+       struct emc_mode *mode, *target_mode = NULL;
        int need_online_cnt, need_boost_cnt;
 
        /* if there is no boostable cpu, we don't need to booting */
@@ -442,12 +442,15 @@ static struct emc_mode* emc_select_mode(void)
                        continue;
                if (need_online_cnt > cpumask_weight(&mode->cpus))
                        continue;
+               target_mode = mode;
                break;
        }
+       if (!target_mode)
+               target_mode = emc_get_base_mode();
 
-       trace_emc_select_mode(mode->name, need_boost_cnt, need_online_cnt);
+       trace_emc_select_mode(target_mode->name, need_boost_cnt, need_online_cnt);
 
-       return mode;
+       return target_mode;
 }
 
 /* return latest adaptive mode */