From: Yicong Yang <yangyicong@huawei.com>
To: <jonathan.cameron@huawei.com>, <will@kernel.org>,
<mark.rutland@arm.com>, <linux-arm-kernel@lists.infradead.org>,
<linux-kernel@vger.kernel.org>
Cc: <hejunhao3@huawei.com>, <prime.zeng@hisilicon.com>,
<yangyicong@hisilicon.com>, <linuxarm@huawei.com>
Subject: [PATCH 2/2] drivers/perf: hisi_pcie: Initialize event->cpu only on success
Date: Tue, 24 Oct 2023 17:29:54 +0800 [thread overview]
Message-ID: <20231024092954.42297-3-yangyicong@huawei.com> (raw)
In-Reply-To: <20231024092954.42297-1-yangyicong@huawei.com>
From: Yicong Yang <yangyicong@hisilicon.com>
Initialize the event->cpu only on success. To be more reasonable
and keep consistent with other PMUs.
Signed-off-by: Yicong Yang <yangyicong@hisilicon.com>
---
drivers/perf/hisilicon/hisi_pcie_pmu.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/perf/hisilicon/hisi_pcie_pmu.c b/drivers/perf/hisilicon/hisi_pcie_pmu.c
index 051efffc44c8..b90ba8aca3fa 100644
--- a/drivers/perf/hisilicon/hisi_pcie_pmu.c
+++ b/drivers/perf/hisilicon/hisi_pcie_pmu.c
@@ -357,8 +357,6 @@ static int hisi_pcie_pmu_event_init(struct perf_event *event)
if (event->attr.type != event->pmu->type)
return -ENOENT;
- event->cpu = pcie_pmu->on_cpu;
-
if (EXT_COUNTER_IS_USED(hisi_pcie_get_event(event)))
hwc->event_base = HISI_PCIE_EXT_CNT;
else
@@ -374,6 +372,8 @@ static int hisi_pcie_pmu_event_init(struct perf_event *event)
if (!hisi_pcie_pmu_validate_event_group(event))
return -EINVAL;
+ event->cpu = pcie_pmu->on_cpu;
+
return 0;
}
--
2.24.0
next prev parent reply other threads:[~2023-10-24 9:34 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-24 9:29 [PATCH 0/2] Minor fix and cleanup for hisi_pcie_pmu Yicong Yang
2023-10-24 9:29 ` [PATCH 1/2] drivers/perf: hisi_pcie: Check the type first in pmu::event_init() Yicong Yang
2023-10-24 9:29 ` Yicong Yang [this message]
2023-10-24 12:51 ` [PATCH 0/2] Minor fix and cleanup for hisi_pcie_pmu Will Deacon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20231024092954.42297-3-yangyicong@huawei.com \
--to=yangyicong@huawei.com \
--cc=hejunhao3@huawei.com \
--cc=jonathan.cameron@huawei.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxarm@huawei.com \
--cc=mark.rutland@arm.com \
--cc=prime.zeng@hisilicon.com \
--cc=will@kernel.org \
--cc=yangyicong@hisilicon.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®