Skip to content

Commit eeeff53

Browse files
Thomas RichterAlexander Gordeev
authored andcommitted
s390/cpum_sf: simplify function setup_pmu_cpu
Print the error message when the FAILURE flag is set. This saves on pr_err statement as the text of the error message is identical in both failures. Also observe reverse Xmas tree variable declarations in this function. No functional change. Signed-off-by: Thomas Richter <tmricht@linux.ibm.com> Acked-by: Heiko Carstens <hca@linux.ibm.com> Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
1 parent f4767f9 commit eeeff53

1 file changed

Lines changed: 5 additions & 10 deletions

File tree

arch/s390/kernel/perf_cpum_sf.c

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -594,10 +594,9 @@ static DEFINE_MUTEX(pmc_reserve_mutex);
594594
#define PMC_FAILURE 2
595595
static void setup_pmc_cpu(void *flags)
596596
{
597-
int err;
598597
struct cpu_hw_sf *cpusf = this_cpu_ptr(&cpu_hw_sf);
598+
int err = 0;
599599

600-
err = 0;
601600
switch (*((int *) flags)) {
602601
case PMC_INIT:
603602
memset(cpusf, 0, sizeof(*cpusf));
@@ -606,22 +605,18 @@ static void setup_pmc_cpu(void *flags)
606605
break;
607606
cpusf->flags |= PMU_F_RESERVED;
608607
err = sf_disable();
609-
if (err)
610-
pr_err("Switching off the sampling facility failed "
611-
"with rc %i\n", err);
612608
break;
613609
case PMC_RELEASE:
614610
cpusf->flags &= ~PMU_F_RESERVED;
615611
err = sf_disable();
616-
if (err) {
617-
pr_err("Switching off the sampling facility failed "
618-
"with rc %i\n", err);
619-
} else
612+
if (!err)
620613
deallocate_buffers(cpusf);
621614
break;
622615
}
623-
if (err)
616+
if (err) {
624617
*((int *) flags) |= PMC_FAILURE;
618+
pr_err("Switching off the sampling facility failed with rc %i\n", err);
619+
}
625620
}
626621

627622
static void release_pmc_hardware(void)

0 commit comments

Comments
 (0)