From 881b456fa5a996a15c29307a551b4aa65280782d Mon Sep 17 00:00:00 2001 From: Youngtae Lee Date: Fri, 4 May 2018 10:26:58 +0900 Subject: [PATCH] samsung: emc: fix bug that return wrong pointer of head list Change-Id: I6ebfa125f5c60255dfcfc6cfe10510e273246559 Signed-off-by: Youngtae Lee --- drivers/soc/samsung/exynos-emc.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/soc/samsung/exynos-emc.c b/drivers/soc/samsung/exynos-emc.c index 7af21c82f09b..55ca20125f80 100644 --- a/drivers/soc/samsung/exynos-emc.c +++ b/drivers/soc/samsung/exynos-emc.c @@ -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 */ -- 2.20.1