diff options
author | Yicong Yang <yangyicong@hisilicon.com> | 2023-10-24 17:29:54 +0800 |
---|---|---|
committer | Will Deacon <will@kernel.org> | 2023-10-24 12:30:45 +0100 |
commit | 868f8a709874729998bcad3422124b678b18b755 (patch) | |
tree | 524edb7f54a7cfd666d40e77c3f88010509b2445 /drivers/perf | |
parent | 6d7d51e88e21c0af1ca96a3617afef334bfeffcf (diff) | |
download | lwn-868f8a709874729998bcad3422124b678b18b755.tar.gz lwn-868f8a709874729998bcad3422124b678b18b755.zip |
drivers/perf: hisi_pcie: Initialize event->cpu only on success
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>
Link: https://lore.kernel.org/r/20231024092954.42297-3-yangyicong@huawei.com
Signed-off-by: Will Deacon <will@kernel.org>
Diffstat (limited to 'drivers/perf')
-rw-r--r-- | drivers/perf/hisilicon/hisi_pcie_pmu.c | 4 |
1 files 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; } |