Commit b33492ad authored by Davidlohr Bueso's avatar Davidlohr Bueso Committed by Arnaldo Carvalho de Melo

perf lock: Return proper code in report_lock_*_event

The report_lock_*_event() functions return -1 when lock_stat_findnew(),
thread_stat_findnew() or get_seq() return NULL. These functions only
return this value when failing to allocate memory, this return -ENOMEM
instead.
Signed-off-by: default avatarDavidlohr Bueso <davidlohr@hp.com>
Cc: Aswin Chandramouleeswaran <aswin@hp.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Hitoshi Mitake <mitake@dcl.info.waseda.ac.jp>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/1378693159-8747-3-git-send-email-davidlohr@hp.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 02ad0702
...@@ -400,17 +400,17 @@ static int report_lock_acquire_event(struct perf_evsel *evsel, ...@@ -400,17 +400,17 @@ static int report_lock_acquire_event(struct perf_evsel *evsel,
ls = lock_stat_findnew(addr, name); ls = lock_stat_findnew(addr, name);
if (!ls) if (!ls)
return -1; return -ENOMEM;
if (ls->discard) if (ls->discard)
return 0; return 0;
ts = thread_stat_findnew(sample->tid); ts = thread_stat_findnew(sample->tid);
if (!ts) if (!ts)
return -1; return -ENOMEM;
seq = get_seq(ts, addr); seq = get_seq(ts, addr);
if (!seq) if (!seq)
return -1; return -ENOMEM;
switch (seq->state) { switch (seq->state) {
case SEQ_STATE_UNINITIALIZED: case SEQ_STATE_UNINITIALIZED:
...@@ -472,17 +472,17 @@ static int report_lock_acquired_event(struct perf_evsel *evsel, ...@@ -472,17 +472,17 @@ static int report_lock_acquired_event(struct perf_evsel *evsel,
ls = lock_stat_findnew(addr, name); ls = lock_stat_findnew(addr, name);
if (!ls) if (!ls)
return -1; return -ENOMEM;
if (ls->discard) if (ls->discard)
return 0; return 0;
ts = thread_stat_findnew(sample->tid); ts = thread_stat_findnew(sample->tid);
if (!ts) if (!ts)
return -1; return -ENOMEM;
seq = get_seq(ts, addr); seq = get_seq(ts, addr);
if (!seq) if (!seq)
return -1; return -ENOMEM;
switch (seq->state) { switch (seq->state) {
case SEQ_STATE_UNINITIALIZED: case SEQ_STATE_UNINITIALIZED:
...@@ -533,17 +533,17 @@ static int report_lock_contended_event(struct perf_evsel *evsel, ...@@ -533,17 +533,17 @@ static int report_lock_contended_event(struct perf_evsel *evsel,
ls = lock_stat_findnew(addr, name); ls = lock_stat_findnew(addr, name);
if (!ls) if (!ls)
return -1; return -ENOMEM;
if (ls->discard) if (ls->discard)
return 0; return 0;
ts = thread_stat_findnew(sample->tid); ts = thread_stat_findnew(sample->tid);
if (!ts) if (!ts)
return -1; return -ENOMEM;
seq = get_seq(ts, addr); seq = get_seq(ts, addr);
if (!seq) if (!seq)
return -1; return -ENOMEM;
switch (seq->state) { switch (seq->state) {
case SEQ_STATE_UNINITIALIZED: case SEQ_STATE_UNINITIALIZED:
...@@ -587,17 +587,17 @@ static int report_lock_release_event(struct perf_evsel *evsel, ...@@ -587,17 +587,17 @@ static int report_lock_release_event(struct perf_evsel *evsel,
ls = lock_stat_findnew(addr, name); ls = lock_stat_findnew(addr, name);
if (!ls) if (!ls)
return -1; return -ENOMEM;
if (ls->discard) if (ls->discard)
return 0; return 0;
ts = thread_stat_findnew(sample->tid); ts = thread_stat_findnew(sample->tid);
if (!ts) if (!ts)
return -1; return -ENOMEM;
seq = get_seq(ts, addr); seq = get_seq(ts, addr);
if (!seq) if (!seq)
return -1; return -ENOMEM;
switch (seq->state) { switch (seq->state) {
case SEQ_STATE_UNINITIALIZED: case SEQ_STATE_UNINITIALIZED:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment