From: Youngtae Lee Date: Fri, 4 May 2018 01:26:58 +0000 (+0900) Subject: samsung: emc: fix bug that return wrong pointer of head list X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=881b456fa5a996a15c29307a551b4aa65280782d;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git samsung: emc: fix bug that return wrong pointer of head list Change-Id: I6ebfa125f5c60255dfcfc6cfe10510e273246559 Signed-off-by: Youngtae Lee --- 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 */