Skip to contentSkip to conversation

perf/x86/intel/pt: Return an error code only as a constant in pt_pmu_hw_init()

PATCH New Markus Elfring 1 participant 1 message Dec 23, 2023

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 perf/x86/intel/pt: Return an error code only as a constant in pt_pmu_hw_init()

From: Markus Elfring <[email protected]>
Date: Sat, 23 Dec 2023 21:06:27 +0100

Return an error code without storing it in an intermediate variable.

---
 arch/x86/events/intel/pt.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
arch/x86/events/intel/pt.c +2 -5
index 8e2a12235e62..24fd18e2da34 100644
@@ -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