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

perf/x86/amd/uncore: Pass through error code for initialization failures, instead of -ENODEV

Pass through the appropriate error code when the registration of hotplug
callbacks fail during initialization, instead of returning a blanket -ENODEV.

[ mingo: Updated the changelog. ]

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>
Link: https://lore.kernel.org/r/20231016060743.332051-1-sandipan.das@amd.com

authored by

Sandipan Das and committed by
Ingo Molnar
744940f1 75433657

+15 -10
+15 -10
arch/x86/events/amd/uncore.c
··· 1040 1040 /* 1041 1041 * Install callbacks. Core will call them for each online cpu. 1042 1042 */ 1043 - if (cpuhp_setup_state(CPUHP_PERF_X86_AMD_UNCORE_PREP, 1044 - "perf/x86/amd/uncore:prepare", 1045 - NULL, amd_uncore_cpu_dead)) 1043 + ret = cpuhp_setup_state(CPUHP_PERF_X86_AMD_UNCORE_PREP, 1044 + "perf/x86/amd/uncore:prepare", 1045 + NULL, amd_uncore_cpu_dead); 1046 + if (ret) 1046 1047 goto fail; 1047 1048 1048 - if (cpuhp_setup_state(CPUHP_AP_PERF_X86_AMD_UNCORE_STARTING, 1049 - "perf/x86/amd/uncore:starting", 1050 - amd_uncore_cpu_starting, NULL)) 1049 + ret = cpuhp_setup_state(CPUHP_AP_PERF_X86_AMD_UNCORE_STARTING, 1050 + "perf/x86/amd/uncore:starting", 1051 + amd_uncore_cpu_starting, NULL); 1052 + if (ret) 1051 1053 goto fail_prep; 1052 - if (cpuhp_setup_state(CPUHP_AP_PERF_X86_AMD_UNCORE_ONLINE, 1053 - "perf/x86/amd/uncore:online", 1054 - amd_uncore_cpu_online, 1055 - amd_uncore_cpu_down_prepare)) 1054 + 1055 + ret = cpuhp_setup_state(CPUHP_AP_PERF_X86_AMD_UNCORE_ONLINE, 1056 + "perf/x86/amd/uncore:online", 1057 + amd_uncore_cpu_online, 1058 + amd_uncore_cpu_down_prepare); 1059 + if (ret) 1056 1060 goto fail_start; 1061 + 1057 1062 return 0; 1058 1063 1059 1064 fail_start: