Skip to content

Commit 94414ca

Browse files
JuliaLawallMartin Schwidefsky
authored andcommitted
s390/oprofile: make return of 0 explicit
Delete unnecessary local variable whose value is always 0 and that hides the fact that the result is always 0. A simplified version of the semantic patch that fixes this problem is as follows: (http://coccinelle.lip6.fr/) // <smpl> @r exists@ local idexpression ret; expression e; position p; @@ -ret = 0; ... when != ret = e return - ret + 0 ; // </smpl> [heiko.carstens: turn prepare_cpu_buffers into a void returning function] Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
1 parent 470ada6 commit 94414ca

1 file changed

Lines changed: 4 additions & 10 deletions

File tree

‎arch/s390/oprofile/hwsampler.c‎

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -209,13 +209,11 @@ static void init_all_cpu_buffers(void)
209209
}
210210
}
211211

212-
static int prepare_cpu_buffers(void)
212+
static void prepare_cpu_buffers(void)
213213
{
214-
int cpu;
215-
int rc;
216214
struct hws_cpu_buffer *cb;
215+
int cpu;
217216

218-
rc = 0;
219217
for_each_online_cpu(cpu) {
220218
cb = &per_cpu(sampler_cpu_buffer, cpu);
221219
atomic_set(&cb->ext_params, 0);
@@ -230,8 +228,6 @@ static int prepare_cpu_buffers(void)
230228
cb->oom = 0;
231229
cb->stop_mode = 0;
232230
}
233-
234-
return rc;
235231
}
236232

237233
/*
@@ -1107,9 +1103,7 @@ int hwsampler_start_all(unsigned long rate)
11071103
if (rc)
11081104
goto start_all_exit;
11091105

1110-
rc = prepare_cpu_buffers();
1111-
if (rc)
1112-
goto start_all_exit;
1106+
prepare_cpu_buffers();
11131107

11141108
for_each_online_cpu(cpu) {
11151109
rc = start_sampling(cpu);
@@ -1156,7 +1150,7 @@ int hwsampler_stop_all(void)
11561150
rc = 0;
11571151
if (hws_state == HWS_INIT) {
11581152
mutex_unlock(&hws_sem);
1159-
return rc;
1153+
return 0;
11601154
}
11611155
hws_state = HWS_STOPPING;
11621156
mutex_unlock(&hws_sem);

0 commit comments

Comments
 (0)