From dbf7c70e04a4f05f90d99d466eaad1932b0e0460 Mon Sep 17 00:00:00 2001 From: Remy Noel Date: Fri, 4 May 2018 01:18:12 +0200 Subject: pmu: fix driver initialization. --- arch/x86/machine/pmu_amd.c | 1 + arch/x86/machine/pmu_intel.c | 3 +-- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/x86/machine/pmu_amd.c b/arch/x86/machine/pmu_amd.c index 8e56bfa..82dc9de 100644 --- a/arch/x86/machine/pmu_amd.c +++ b/arch/x86/machine/pmu_amd.c @@ -226,6 +226,7 @@ pmu_amd_setup(void) pmu = pmu_amd_get(); pmu->pmc_bm = (1U << PMU_AMD_NR_PMCS) - 1; + memset(&pmu_driver, 0, sizeof(pmu_driver)); pmu_driver.pmc_width = PMU_AMD_PMC_WIDTH; /* Set max_tick to half the number of instruction per seconds. */ pmu_driver.of_max_ticks = diff --git a/arch/x86/machine/pmu_intel.c b/arch/x86/machine/pmu_intel.c index 6fbdbae..8b2f309 100644 --- a/arch/x86/machine/pmu_intel.c +++ b/arch/x86/machine/pmu_intel.c @@ -354,6 +354,7 @@ pmu_intel_setup(void) pmu->events = ~ebx & ((1U << ev_len) - 1); + memset(&pmu_driver, 0, sizeof(pmu_driver)); pmu_driver.pmc_width = pmu->pmc_width; pmu_driver.ops.info = pmu_intel_info; pmu_driver.ops.translate = pmu_intel_translate; @@ -366,10 +367,8 @@ pmu_intel_setup(void) if (pmu->version >= 2) { pmu_driver.ops.handle_of_intr = pmu_intel_handle_of_intr_v2; - pmu_driver.of_max_ticks = 0; } else { /* Set max_tick to half the number of instruction per seconds. */ - pmu_driver.ops.handle_of_intr = NULL; pmu_driver.of_max_ticks = (1ULL << (pmu_driver.pmc_width - 1)) / (cpu_get_freq() / CLOCK_FREQ); } -- cgit v1.2.3