eina_cpu: Fix error handling in eina_cpu_fast_core_get
authorDerek Foreman <derekf@osg.samsung.com>
Mon, 19 Sep 2016 14:23:59 +0000 (09:23 -0500)
committerDerek Foreman <derekf@osg.samsung.com>
Mon, 19 Sep 2016 14:23:59 +0000 (09:23 -0500)
I introduced a crash on linux systems where the cpufreq directory
doesn't exist.  This fixes it.

src/lib/eina/eina_cpu.c

index 1de86d8..b5e6b90 100644 (file)
@@ -396,6 +396,9 @@ _eina_cpu_fast_core_get(void)
 
    if (fastest_core_speed == 0) eina_cpu_map_init();
 
+   /* Check again now that it's actually set up */
+   if (fastest_core_speed == -1) return -1;
+
    corelist = eina_hash_find(cpu_hash, &fastest_core_speed);
    cores = *corelist;
    bit = rand() % __builtin_popcount(cores);