diff options
author | Zoran Markovic <zoran.markovic@linaro.org> | 2014-01-29 15:47:47 -0800 |
---|---|---|
committer | Zoran Markovic <zoran.markovic@linaro.org> | 2014-01-29 15:47:47 -0800 |
commit | da6a8c94a8f8124711db0ae84a3ef4e0e186b388 (patch) | |
tree | 561281de99ca73767a7d694ceae37ca81d2d1f35 | |
parent | 7cf042383726a9a2516d03ad52c9e87ab24652a1 (diff) |
Fixing improperly initialized cstate_max per-CPU.
-rw-r--r-- | idlestat.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -240,7 +240,7 @@ static int store_data(double time, int state, int cpu, int nrdata, last_cstate = cstates->last_cstate; /* ignore when we got a "closing" state first */ - if (state == -1 && !cstates->cstate_max) + if (state == -1 && cstates->cstate_max == -1) return 0; cstate = &cstates->cstate[state == -1 ? last_cstate : state ]; @@ -398,6 +398,9 @@ static struct cpuidle_datas *idlestat_load(const char *path) datas->cstates = calloc(sizeof(*datas->cstates), nrcpus); if (!datas->cstates) return ptrerror("calloc cstate"); + /* initialize cstate_max for each cpu */ + for (cpu = 0; cpu < nrcpus; cpu++) + datas->cstates[cpu].cstate_max = -1; datas->nrcpus = nrcpus; |