Skip to contentSkip to conversation

perf/x86/uncore: Remove unnecessary check for uncore_pmu

PATCH In review [email protected] 2 participants 3 messages Nov 13, 2019 – Nov 18, 2019

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

PATCH 1/1 perf/x86/uncore: Remove unnecessary check for uncore_pmu

From: Kan Liang <[email protected]>

The uncore_pmu pointer in uncore_pmu_enable/disable() is from container_of, which never be NULL.

Remove the unnecessary check for uncore_pmu.

Fixes 75be6f703a14 ("perf/x86/uncore: Fix event group support")
---
 arch/x86/events/intel/uncore.c | 6 ------
 1 file changed, 6 deletions(-)
arch/x86/events/intel/uncore.c +0 -6
index 86467f8..81eed07 100644
@@ -780,9 +780,6 @@ static void uncore_pmu_enable(struct pmu *pmu)
 	struct intel_uncore_box *box;
 
 	uncore_pmu = container_of(pmu, struct intel_uncore_pmu, pmu);
-	if (!uncore_pmu)
-		return;
-
 	box = uncore_pmu_to_box(uncore_pmu, smp_processor_id());
 	if (!box)
 		return;
@@ -797,9 +794,6 @@ static void uncore_pmu_disable(struct pmu *pmu)
 	struct intel_uncore_box *box;
 
 	uncore_pmu = container_of(pmu, struct intel_uncore_pmu, pmu);
-	if (!uncore_pmu)
-		return;
-
 	box = uncore_pmu_to_box(uncore_pmu, smp_processor_id());
 	if (!box)
 		return;
Signature · 1 line
2.7.4
Acked-by on v1 1/1
#1 lore raw
Quoted 11 lines · On Wed 2019-11-13 05:35:02, [email protected] wrote:

From: Kan Liang <[email protected]>

The uncore_pmu pointer in uncore_pmu_enable/disable() is from container_of, which never be NULL.

Remove the unnecessary check for uncore_pmu.

Fixes 75be6f703a14 ("perf/x86/uncore: Fix event group support")

Thanks for doing this.

Pavel

Signature · 2 lines
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
#2 lore raw
In reply to [email protected]
Quoted 11 lines · On Wed 2019-11-13 05:35:02, [email protected] wrote:

From: Kan Liang <[email protected]>

The uncore_pmu pointer in uncore_pmu_enable/disable() is from container_of, which never be NULL.

Remove the unnecessary check for uncore_pmu.

Fixes 75be6f703a14 ("perf/x86/uncore: Fix event group support")

Sorry, sent email too fast.

I agree this is good fix for mainline, but as the code is a tiny bit ineffective but correct, I don't think we neccessarily need it in stable.

Best regards,
Pavel

Signature · 2 lines
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany