[<prev] [next>] [day] [month] [year] [list]
Message-ID: <5b38ce71-3c76-4efc-a688-6f2651f93b6d@web.de>
Date: Sat, 23 Dec 2023 21:30:17 +0100
From: Markus Elfring <Markus.Elfring@....de>
To: linux-perf-users@...r.kernel.org, kernel-janitors@...r.kernel.org,
Adrian Hunter <adrian.hunter@...el.com>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Arnaldo Carvalho de Melo <acme@...nel.org>, Borislav Petkov <bp@...en8.de>,
Dave Hansen <dave.hansen@...ux.intel.com>, "H. Peter Anvin" <hpa@...or.com>,
Ian Rogers <irogers@...gle.com>, Ingo Molnar <mingo@...hat.com>,
Jiri Olsa <jolsa@...nel.org>, Mark Rutland <mark.rutland@....com>,
Namhyung Kim <namhyung@...nel.org>, Peter Zijlstra <peterz@...radead.org>,
Thomas Gleixner <tglx@...utronix.de>, x86@...nel.org
Cc: LKML <linux-kernel@...r.kernel.org>, cocci@...ia.fr
Subject: [PATCH] perf/x86/intel/pt: Return an error code only as a constant in
pt_pmu_hw_init()
From: Markus Elfring <elfring@...rs.sourceforge.net>
Date: Sat, 23 Dec 2023 21:06:27 +0100
Return an error code without storing it in an intermediate variable.
Signed-off-by: Markus Elfring <elfring@...rs.sourceforge.net>
---
arch/x86/events/intel/pt.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/arch/x86/events/intel/pt.c b/arch/x86/events/intel/pt.c
index 8e2a12235e62..24fd18e2da34 100644
--- a/arch/x86/events/intel/pt.c
+++ b/arch/x86/events/intel/pt.c
@@ -190,7 +190,6 @@ static int __init pt_pmu_hw_init(void)
struct attribute **attrs;
size_t size;
u64 reg;
- int ret;
long i;
rdmsrl(MSR_PLATFORM_INFO, reg);
@@ -242,11 +241,10 @@ static int __init pt_pmu_hw_init(void)
&pt_pmu.caps[CPUID_EDX + i*PT_CPUID_REGS_NUM]);
}
- ret = -ENOMEM;
size = sizeof(struct attribute *) * (ARRAY_SIZE(pt_caps)+1);
attrs = kzalloc(size, GFP_KERNEL);
if (!attrs)
- goto fail;
+ return -ENOMEM;
size = sizeof(struct dev_ext_attribute) * (ARRAY_SIZE(pt_caps)+1);
de_attrs = kzalloc(size, GFP_KERNEL);
@@ -273,8 +271,7 @@ static int __init pt_pmu_hw_init(void)
fail:
kfree(attrs);
-
- return ret;
+ return -ENOMEM;
}
#define RTIT_CTL_CYC_PSB (RTIT_CTL_CYCLEACC | \
--
2.43.0
Powered by blists - more mailing lists