From: Tanmay Jagdale Date: Tue, 10 May 2022 10:26:57 +0000 (+0530) Subject: perf/marvell_cn10k: Fix tad_pmu_event_init() to check pmu type first X-Git-Tag: v5.19-rc1~208^2~6 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=33835e8dfb3c79821cdc6e2a9b48ae05bd4820dc;p=thirdparty%2Fkernel%2Flinux.git 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 Link: https://lore.kernel.org/r/20220510102657.487539-1-tanmay@marvell.com Signed-off-by: Will Deacon --- diff --git a/drivers/perf/marvell_cn10k_tad_pmu.c b/drivers/perf/marvell_cn10k_tad_pmu.c index ee67305f822d0..282d3a071a67c 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;