Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

perf/x86/amd/uncore: Fix the return value of amd_uncore_df_event_init() on error

If amd_uncore_event_init() fails, return an error irrespective of the
pmu_version. Setting hwc->config should be safe even if there is an
error so use this opportunity to simplify the code.

Closes: https://lore.kernel.org/all/aTaI0ci3vZ44lmBn@stanley.mountain/

Fixes: d6389d3ccc13 ("perf/x86/amd/uncore: Refactor uncore management")
Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Signed-off-by: Sandipan Das <sandipan.das@amd.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: stable@vger.kernel.org
Link: https://patch.msgid.link/076935e23a70335d33bd6e23308b75ae0ad35ba2.1765268667.git.sandipan.das@amd.com

authored by

Sandipan Das and committed by
Ingo Molnar
01439286 92546f6b

+1 -4
+1 -4
arch/x86/events/amd/uncore.c
··· 656 656 struct hw_perf_event *hwc = &event->hw; 657 657 int ret = amd_uncore_event_init(event); 658 658 659 - if (ret || pmu_version < 2) 660 - return ret; 661 - 662 659 hwc->config = event->attr.config & 663 660 (pmu_version >= 2 ? AMD64_PERFMON_V2_RAW_EVENT_MASK_NB : 664 661 AMD64_RAW_EVENT_MASK_NB); 665 662 666 - return 0; 663 + return ret; 667 664 } 668 665 669 666 static int amd_uncore_df_add(struct perf_event *event, int flags)