mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] perf/marvell_cn10k: Fix tad_pmu_event_init() to check pmu type first
@ 2022-05-10 10:26 Tanmay Jagdale
  2022-05-10 11:33 ` Will Deacon
  0 siblings, 1 reply; 2+ messages in thread
From: Tanmay Jagdale @ 2022-05-10 10:26 UTC (permalink / raw)
  To: will, mark.rutland
  Cc: sgoutham, bbhushan2, lcherian, linux-arm-kernel, linux-kernel,
	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.

Signed-off-by: Tanmay Jagdale <tanmay@marvell.com>
---
 drivers/perf/marvell_cn10k_tad_pmu.c | 6 +++---
 1 file 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;
 
-- 
2.25.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] perf/marvell_cn10k: Fix tad_pmu_event_init() to check pmu type first
  2022-05-10 10:26 [PATCH] perf/marvell_cn10k: Fix tad_pmu_event_init() to check pmu type first Tanmay Jagdale
@ 2022-05-10 11:33 ` Will Deacon
  0 siblings, 0 replies; 2+ messages in thread
From: Will Deacon @ 2022-05-10 11:33 UTC (permalink / raw)
  To: Tanmay Jagdale, mark.rutland
  Cc: catalin.marinas, kernel-team, Will Deacon, linux-kernel,
	lcherian, sgoutham, bbhushan2, linux-arm-kernel

On Tue, 10 May 2022 15:56:57 +0530, Tanmay Jagdale wrote:
> 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,
-- 
Will

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-05-10 11:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-10 10:26 [PATCH] perf/marvell_cn10k: Fix tad_pmu_event_init() to check pmu type first Tanmay Jagdale
2022-05-10 11:33 ` Will Deacon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®