Skip to content

Commit 33835e8

Browse files
Tanmay Jagdalewilldeacon
authored andcommitted
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. Signed-off-by: Tanmay Jagdale <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Will Deacon <[email protected]>
1 parent 6b79738 commit 33835e8

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

drivers/perf/marvell_cn10k_tad_pmu.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,12 +146,12 @@ static int tad_pmu_event_init(struct perf_event *event)
146146
{
147147
struct tad_pmu *tad_pmu = to_tad_pmu(event->pmu);
148148

149-
if (!event->attr.disabled)
150-
return -EINVAL;
151-
152149
if (event->attr.type != event->pmu->type)
153150
return -ENOENT;
154151

152+
if (!event->attr.disabled)
153+
return -EINVAL;
154+
155155
if (event->state != PERF_EVENT_STATE_OFF)
156156
return -EINVAL;
157157

0 commit comments

Comments
 (0)