[RAMEN9610-9418][COMMON] sched: ems: Modify get_cpu_max_capacity not to access NULL...
authorDaeyeong Lee <daeyeong.lee@samsung.com>
Mon, 15 Oct 2018 06:36:06 +0000 (15:36 +0900)
committerCosmin Tanislav <demonsingur@gmail.com>
Mon, 22 Apr 2024 17:24:57 +0000 (20:24 +0300)
Change-Id: I2a88779e24ba4f30d0423224d3cdc78aea6e586a
Signed-off-by: Daeyeong Lee <daeyeong.lee@samsung.com>
kernel/sched/ems/energy.c

index 7acd9adc210e77893222695eebeefc8c91d53864..def7c302ec0f5d3b3acaed082533b6dbf592d097 100644 (file)
@@ -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;
 }