From: Daeyeong Lee Date: Mon, 15 Oct 2018 06:36:06 +0000 (+0900) Subject: [RAMEN9610-9418][COMMON] sched: ems: Modify get_cpu_max_capacity not to access NULL... X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=ddf027e210882023131ca7f5f290bfcafca68188;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git [RAMEN9610-9418][COMMON] sched: ems: Modify get_cpu_max_capacity not to access NULL point Change-Id: I2a88779e24ba4f30d0423224d3cdc78aea6e586a Signed-off-by: Daeyeong Lee --- diff --git a/kernel/sched/ems/energy.c b/kernel/sched/ems/energy.c index a609b611bdf1..bb0bf5bc53d4 100644 --- a/kernel/sched/ems/energy.c +++ b/kernel/sched/ems/energy.c @@ -45,6 +45,10 @@ unsigned int get_cpu_max_capacity(unsigned int cpu) { struct energy_table *table = &per_cpu(energy_table, cpu); + /* If energy table wasn't initialized, return 0 as capacity */ + if (!table->states) + return 0; + return table->states[table->nr_states - 1].cap; }