summaryrefslogtreecommitdiff
path: root/drivers/perf
diff options
context:
space:
mode:
authorTanmay Jagdale <tanmay@marvell.com>2022-05-10 13:26:57 +0300
committerWill Deacon <will@kernel.org>2022-05-10 14:14:27 +0300
commit33835e8dfb3c79821cdc6e2a9b48ae05bd4820dc (patch)
tree2683cfe1750bab8b6c6c37841fc6dd32007a26a7 /drivers/perf
parent6b79738b6ed91a2d0fe958819469eeedac3bca81 (diff)
downloadlinux-33835e8dfb3c79821cdc6e2a9b48ae05bd4820dc.tar.xz
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 <tanmay@marvell.com> Link: https://lore.kernel.org/r/20220510102657.487539-1-tanmay@marvell.com Signed-off-by: Will Deacon <will@kernel.org>
Diffstat (limited to 'drivers/perf')
-rw-r--r--drivers/perf/marvell_cn10k_tad_pmu.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/perf/marvell_cn10k_tad_pmu.c b/drivers/perf/marvell_cn10k_tad_pmu.c
index ee67305f822d..282d3a071a67 100644
--- a/drivers/perf/marvell_cn10k_tad_pmu.c
+++ b/drivers/perf/marvell_cn10k_tad_pmu.c
@@ -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;