summaryrefslogtreecommitdiff
path: root/drivers/oprofile/oprofile_perf.c
diff options
context:
space:
mode:
authorRobert Richter <robert.richter@amd.com>2010-09-29 14:43:29 +0200
committerRobert Richter <robert.richter@amd.com>2010-10-11 19:34:03 +0200
commit2bcb2b641a8f1524f7a9801eb9e52a00b8f18c6e (patch)
tree1faeb9a6d2aecf54259205341c17fd9aef2bd5e6 /drivers/oprofile/oprofile_perf.c
parent9c91283a19c2d998a83f50f113f8585709c15caf (diff)
oprofile, ARM: Rework op_create_counter()
This patch simplifies op_create_counter(). Removing if/else if paths and return code variable by direct returning from function. Acked-by: Will Deacon <will.deacon@arm.com> Signed-off-by: Robert Richter <robert.richter@amd.com>
Diffstat (limited to 'drivers/oprofile/oprofile_perf.c')
-rw-r--r--drivers/oprofile/oprofile_perf.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/drivers/oprofile/oprofile_perf.c b/drivers/oprofile/oprofile_perf.c
index 6853634c4681..a34137f2e26c 100644
--- a/drivers/oprofile/oprofile_perf.c
+++ b/drivers/oprofile/oprofile_perf.c
@@ -71,28 +71,28 @@ static void op_perf_setup(void)
static int op_create_counter(int cpu, int event)
{
- int ret = 0;
struct perf_event *pevent;
- if (!counter_config[event].enabled || (perf_events[cpu][event] != NULL))
- return ret;
+ if (!counter_config[event].enabled || perf_events[cpu][event])
+ return 0;
pevent = perf_event_create_kernel_counter(&counter_config[event].attr,
cpu, -1,
op_overflow_handler);
- if (IS_ERR(pevent)) {
- ret = PTR_ERR(pevent);
- } else if (pevent->state != PERF_EVENT_STATE_ACTIVE) {
+ if (IS_ERR(pevent))
+ return PTR_ERR(pevent);
+
+ if (pevent->state != PERF_EVENT_STATE_ACTIVE) {
perf_event_release_kernel(pevent);
pr_warning("oprofile: failed to enable event %d "
"on CPU %d\n", event, cpu);
- ret = -EBUSY;
- } else {
- perf_events[cpu][event] = pevent;
+ return -EBUSY;
}
- return ret;
+ perf_events[cpu][event] = pevent;
+
+ return 0;
}
static void op_destroy_counter(int cpu, int event)