Commit 81771974 authored by Robert Richter's avatar Robert Richter

oprofile, ARM: Release resources on failure

This patch fixes a resource leak on failure, where the
oprofilefs and some counters may not released properly.
Signed-off-by: default avatarRobert Richter <robert.richter@amd.com>
Acked-by: default avatarWill Deacon <will.deacon@arm.com>
Cc: linux-arm-kernel@lists.infradead.org
Cc: <stable@kernel.org> # .35.x
LKML-Reference: <20100929145225.GJ13563@erda.amd.com>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent ad0f7cfa
...@@ -84,6 +84,7 @@ static int op_create_counter(int cpu, int event) ...@@ -84,6 +84,7 @@ static int op_create_counter(int cpu, int event)
if (IS_ERR(pevent)) { if (IS_ERR(pevent)) {
ret = PTR_ERR(pevent); ret = PTR_ERR(pevent);
} else if (pevent->state != PERF_EVENT_STATE_ACTIVE) { } else if (pevent->state != PERF_EVENT_STATE_ACTIVE) {
perf_event_release_kernel(pevent);
pr_warning("oprofile: failed to enable event %d " pr_warning("oprofile: failed to enable event %d "
"on CPU %d\n", event, cpu); "on CPU %d\n", event, cpu);
ret = -EBUSY; ret = -EBUSY;
......
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