Re: [PATCH] perf/x86/amd/core: Make amd_core_pmu_init() return void
From: Sandipan Das
Date: Mon Nov 02 2026 - 09:16:34 EST
On 01-11-2026 09:33, Ingyu Jang wrote:
> amd_core_pmu_init() has always returned 0 since commit 471af006a747
> ("perf/x86/amd: Constrain Large Increment per Cycle events") removed
> its -ENODEV path for unknown CPU families, so the error check in
> amd_pmu_init() never triggers.
>
> Change the function's return type to void and remove the dead check.
>
> Signed-off-by: Ingyu Jang <ingyujang25@xxxxxxxxxxx>
> ---
> arch/x86/events/amd/core.c | 11 +++--------
> 1 file changed, 3 insertions(+), 8 deletions(-)
>
> diff --git a/arch/x86/events/amd/core.c b/arch/x86/events/amd/core.c
> index 49b6b8fce5664..c72e745b2591d 100644
> --- a/arch/x86/events/amd/core.c
> +++ b/arch/x86/events/amd/core.c
> @@ -1412,7 +1412,7 @@ static const struct attribute_group *amd_attr_update[] = {
> NULL,
> };
>
> -static int __init amd_core_pmu_init(void)
> +static void __init amd_core_pmu_init(void)
> {
> union cpuid_0x80000022_ebx ebx;
> u64 even_ctr_mask = 0ULL;
> @@ -1422,7 +1422,7 @@ static int __init amd_core_pmu_init(void)
> perf_nmi_window = msecs_to_jiffies(100);
>
> if (!boot_cpu_has(X86_FEATURE_PERFCTR_CORE))
> - return 0;
> + return;
>
> /*
> * If core performance counter extensions exists, we must use
> @@ -1523,22 +1523,17 @@ static int __init amd_core_pmu_init(void)
> x86_pmu.attr_update = amd_attr_update;
>
> pr_cont("core perfctr, ");
> - return 0;
> }
>
> __init int amd_pmu_init(void)
> {
> - int ret;
> -
> /* Performance-monitoring supported from K7 and later: */
> if (boot_cpu_data.x86 < 6)
> return -ENODEV;
>
> x86_pmu = amd_pmu;
>
> - ret = amd_core_pmu_init();
> - if (ret)
> - return ret;
> + amd_core_pmu_init();
>
> if (num_possible_cpus() == 1) {
> /*
Reviewed-by: Sandipan Das <sandipan.das@xxxxxxx>