From ddf027e210882023131ca7f5f290bfcafca68188 Mon Sep 17 00:00:00 2001 From: Daeyeong Lee Date: Mon, 15 Oct 2018 15:36:06 +0900 Subject: [PATCH] [RAMEN9610-9418][COMMON] sched: ems: Modify get_cpu_max_capacity not to access NULL point Change-Id: I2a88779e24ba4f30d0423224d3cdc78aea6e586a Signed-off-by: Daeyeong Lee --- kernel/sched/ems/energy.c | 4 ++++ 1 file changed, 4 insertions(+) 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; } -- 2.20.1