diff --git a/drivers/perf/hisilicon/hns3_pmu.c b/drivers/perf/hisilicon/hns3_pmu.c index 76c2babed4d03e7abf88d3eeb89b7a4a80dbcd4f..92b2f535094b0af8bbcc9f754fda661ba74aadb1 100644 --- a/drivers/perf/hisilicon/hns3_pmu.c +++ b/drivers/perf/hisilicon/hns3_pmu.c @@ -804,9 +804,11 @@ static int hns3_pmu_find_related_event_idx(struct hns3_pmu *hns3_pmu, if (!hns3_pmu_cmp_event(sibling, event)) continue; - /* Related events is used in group */ + /* Related events is used in group, else we use index 0 event as related event */ if (sibling->group_leader == event->group_leader) return idx; + else + return 0; } /* No related event and all hardware events are used up */