Page MenuHomeFreeBSD

D48168.diff
No OneTemporary

D48168.diff

diff --git a/sys/dev/hwpmc/hwpmc_x86.c b/sys/dev/hwpmc/hwpmc_x86.c
--- a/sys/dev/hwpmc/hwpmc_x86.c
+++ b/sys/dev/hwpmc/hwpmc_x86.c
@@ -230,7 +230,7 @@
pmc_md_initialize(void)
{
int i;
- struct pmc_mdep *md;
+ struct pmc_mdep *md = NULL;
/* determine the CPU kind */
if (cpu_vendor_id == CPU_VENDOR_AMD ||
@@ -238,17 +238,18 @@
md = pmc_amd_initialize();
else if (cpu_vendor_id == CPU_VENDOR_INTEL)
md = pmc_intel_initialize();
- else
+
+ if (md == NULL)
return (NULL);
+ nmi_register_handler(md->pmd_intr);
/* disallow sampling if we do not have an LAPIC */
- if (md != NULL && !lapic_enable_pcint())
+ if (!lapic_enable_pcint())
for (i = 0; i < md->pmd_nclass; i++) {
if (i == PMC_CLASS_INDEX_SOFT)
continue;
md->pmd_classdep[i].pcd_caps &= ~PMC_CAP_INTERRUPT;
}
- nmi_register_handler(md->pmd_intr);
return (md);
}
@@ -256,9 +257,10 @@
void
pmc_md_finalize(struct pmc_mdep *md)
{
-
- lapic_disable_pcint();
- nmi_remove_handler(md->pmd_intr);
+ if (md != NULL) {
+ lapic_disable_pcint();
+ nmi_remove_handler(md->pmd_intr);
+ }
if (cpu_vendor_id == CPU_VENDOR_AMD ||
cpu_vendor_id == CPU_VENDOR_HYGON)
pmc_amd_finalize(md);

File Metadata

Mime Type
text/plain
Expires
Sun, Apr 6, 10:09 AM (7 h, 12 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
17402537
Default Alt Text
D48168.diff (1 KB)

Event Timeline