diff --git a/sys/dev/hwpmc/hwpmc_intel.c b/sys/dev/hwpmc/hwpmc_intel.c index 62a1e5225610..026196c5c206 100644 --- a/sys/dev/hwpmc/hwpmc_intel.c +++ b/sys/dev/hwpmc/hwpmc_intel.c @@ -191,7 +191,9 @@ pmc_intel_initialize(void) pmc_mdep->pmd_switch_out = intel_switch_out; ncpus = pmc_cpu_max(); - + error = pmc_tsc_initialize(pmc_mdep, ncpus); + if (error) + goto error; switch (cputype) { #if defined(__i386__) || defined(__amd64__) /* @@ -246,8 +248,10 @@ pmc_intel_initialize(void) KASSERT(0, ("[intel,%d] Unknown CPU type", __LINE__)); } - if (error) + if (error) { + pmc_tsc_finalize(pmc_mdep); goto error; + } /* * Init the uncore class. @@ -267,7 +271,6 @@ pmc_intel_initialize(void) break; } #endif - error = pmc_tsc_initialize(pmc_mdep, ncpus); error: if (error) { pmc_mdep_free(pmc_mdep);