Commit 868f8a70 authored by Yicong Yang's avatar Yicong Yang Committed by Will Deacon

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: default avatarYicong Yang <yangyicong@hisilicon.com>
Link: https://lore.kernel.org/r/20231024092954.42297-3-yangyicong@huawei.comSigned-off-by: default avatarWill Deacon <will@kernel.org>
parent 6d7d51e8
...@@ -357,8 +357,6 @@ static int hisi_pcie_pmu_event_init(struct perf_event *event) ...@@ -357,8 +357,6 @@ static int hisi_pcie_pmu_event_init(struct perf_event *event)
if (event->attr.type != event->pmu->type) if (event->attr.type != event->pmu->type)
return -ENOENT; return -ENOENT;
event->cpu = pcie_pmu->on_cpu;
if (EXT_COUNTER_IS_USED(hisi_pcie_get_event(event))) if (EXT_COUNTER_IS_USED(hisi_pcie_get_event(event)))
hwc->event_base = HISI_PCIE_EXT_CNT; hwc->event_base = HISI_PCIE_EXT_CNT;
else else
...@@ -374,6 +372,8 @@ static int hisi_pcie_pmu_event_init(struct perf_event *event) ...@@ -374,6 +372,8 @@ static int hisi_pcie_pmu_event_init(struct perf_event *event)
if (!hisi_pcie_pmu_validate_event_group(event)) if (!hisi_pcie_pmu_validate_event_group(event))
return -EINVAL; return -EINVAL;
event->cpu = pcie_pmu->on_cpu;
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment