aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZoran Markovic <zoran.markovic@linaro.org>2014-01-29 15:47:47 -0800
committerZoran Markovic <zoran.markovic@linaro.org>2014-01-29 15:47:47 -0800
commitda6a8c94a8f8124711db0ae84a3ef4e0e186b388 (patch)
tree561281de99ca73767a7d694ceae37ca81d2d1f35
parent7cf042383726a9a2516d03ad52c9e87ab24652a1 (diff)
Fixing improperly initialized cstate_max per-CPU.
-rw-r--r--idlestat.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/idlestat.c b/idlestat.c
index ab3aaab..3abfaaf 100644
--- a/idlestat.c
+++ b/idlestat.c
@@ -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;