Skip to contentSkip to conversation

perf/marvell_cn10k: Fix tad_pmu_event_init() to check pmu type first

PATCH Applied Tanmay Jagdale 2 participants 2 messages May 10, 2022 Arm PMU profiling and debugging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 perf/marvell_cn10k: Fix tad_pmu_event_init() to check pmu type first

Make sure to check the pmu type first and then check event->attr.disabled. Doing so would avoid reading the disabled attribute of an event that is not handled by TAD PMU.

---
 drivers/perf/marvell_cn10k_tad_pmu.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/perf/marvell_cn10k_tad_pmu.c +3 -3
index ee67305f822d..282d3a071a67 100644
@@ -146,12 +146,12 @@ static int tad_pmu_event_init(struct perf_event *event)
 {
 	struct tad_pmu *tad_pmu = to_tad_pmu(event->pmu);
 
-	if (!event->attr.disabled)
-		return -EINVAL;
-
 	if (event->attr.type != event->pmu->type)
 		return -ENOENT;
 
+	if (!event->attr.disabled)
+		return -EINVAL;
+
 	if (event->state != PERF_EVENT_STATE_OFF)
 		return -EINVAL;
 
Signature · 1 line
2.25.1
maintainer Applied
#1 lore raw
Quoted 5 lines · Tanmay Jagdale

Make sure to check the pmu type first and then check event->attr.disabled. Doing so would avoid reading the disabled attribute of an event that is not handled by TAD PMU.

Applied to will (for-next/perf), thanks!

[1/1] perf/marvell_cn10k: Fix tad_pmu_event_init() to check pmu type first

      https://git.kernel.org/will/c/33835e8dfb3c

Cheers,

Signature · 5 lines
Will

https://fixes.arm64.dev
https://next.arm64.dev
https://will.arm64.dev