Index: sys/dev/acpi_support/acpi_wmi.c =================================================================== --- sys/dev/acpi_support/acpi_wmi.c +++ sys/dev/acpi_support/acpi_wmi.c @@ -238,15 +238,16 @@ sc->wmi_dev = dev; sc->wmi_handle = acpi_get_handle(dev); TAILQ_INIT(&sc->wmi_info_list); - /* XXX Only works with one EC, but nearly all systems only have one. */ + /* XXX Only works with at most one EC, but nearly all systems only have one. */ if ((sc->ec_dev = devclass_get_device(devclass_find("acpi_ec"), 0)) - == NULL) + == NULL){ device_printf(dev, "cannot find EC device\n"); - else if (ACPI_FAILURE((status = AcpiInstallNotifyHandler(sc->wmi_handle, + } + if (ACPI_FAILURE((status = AcpiInstallNotifyHandler(sc->wmi_handle, ACPI_DEVICE_NOTIFY, acpi_wmi_notify_handler, sc)))) device_printf(sc->wmi_dev, "couldn't install notify handler - %s\n", AcpiFormatException(status)); - else if (ACPI_FAILURE((status = AcpiInstallAddressSpaceHandler( + else if (sc->ec_dev && ACPI_FAILURE((status = AcpiInstallAddressSpaceHandler( sc->wmi_handle, ACPI_ADR_SPACE_EC, acpi_wmi_ec_handler, NULL, sc)))) { device_printf(sc->wmi_dev, "couldn't install EC handler - %s\n", @@ -670,6 +671,12 @@ ACPI_FUNCTION_TRACE_U32((char *)(uintptr_t)__func__, (UINT32)address); sc = (struct acpi_wmi_softc *)context; + + if(sc->ec_dev == NULL){ + device_printf(sc->wmi_dev,"EC not found but handler called\n"); + return AE_ERROR; + } + if (width % 8 != 0 || value == NULL || context == NULL) return (AE_BAD_PARAMETER); if (address + (width / 8) - 1 > 0xFF)