diff options
author | Robert Richter <robert.richter@amd.com> | 2010-09-29 08:43:29 -0400 |
---|---|---|
committer | Robert Richter <robert.richter@amd.com> | 2010-10-11 13:34:03 -0400 |
commit | 2bcb2b641a8f1524f7a9801eb9e52a00b8f18c6e (patch) | |
tree | 1faeb9a6d2aecf54259205341c17fd9aef2bd5e6 /drivers/oprofile/oprofile_perf.c | |
parent | 9c91283a19c2d998a83f50f113f8585709c15caf (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.c | 20 |
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) | |||
71 | 71 | ||
72 | static int op_create_counter(int cpu, int event) | 72 | static int op_create_counter(int cpu, int event) |
73 | { | 73 | { |
74 | int ret = 0; | ||
75 | struct perf_event *pevent; | 74 | struct perf_event *pevent; |
76 | 75 | ||
77 | if (!counter_config[event].enabled || (perf_events[cpu][event] != NULL)) | 76 | if (!counter_config[event].enabled || perf_events[cpu][event]) |
78 | return ret; | 77 | return 0; |
79 | 78 | ||
80 | pevent = perf_event_create_kernel_counter(&counter_config[event].attr, | 79 | pevent = perf_event_create_kernel_counter(&counter_config[event].attr, |
81 | cpu, -1, | 80 | cpu, -1, |
82 | op_overflow_handler); | 81 | op_overflow_handler); |
83 | 82 | ||
84 | if (IS_ERR(pevent)) { | 83 | if (IS_ERR(pevent)) |
85 | ret = PTR_ERR(pevent); | 84 | return PTR_ERR(pevent); |
86 | } else if (pevent->state != PERF_EVENT_STATE_ACTIVE) { | 85 | |
86 | if (pevent->state != PERF_EVENT_STATE_ACTIVE) { | ||
87 | perf_event_release_kernel(pevent); | 87 | perf_event_release_kernel(pevent); |
88 | pr_warning("oprofile: failed to enable event %d " | 88 | pr_warning("oprofile: failed to enable event %d " |
89 | "on CPU %d\n", event, cpu); | 89 | "on CPU %d\n", event, cpu); |
90 | ret = -EBUSY; | 90 | return -EBUSY; |
91 | } else { | ||
92 | perf_events[cpu][event] = pevent; | ||
93 | } | 91 | } |
94 | 92 | ||
95 | return ret; | 93 | perf_events[cpu][event] = pevent; |
94 | |||
95 | return 0; | ||
96 | } | 96 | } |
97 | 97 | ||
98 | static void op_destroy_counter(int cpu, int event) | 98 | static void op_destroy_counter(int cpu, int event) |