summaryrefslogtreecommitdiffstats
path: root/sys/contrib/dev/acpica/components/events/evregion.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/contrib/dev/acpica/components/events/evregion.c')
-rw-r--r--sys/contrib/dev/acpica/components/events/evregion.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/sys/contrib/dev/acpica/components/events/evregion.c b/sys/contrib/dev/acpica/components/events/evregion.c
index 43fe9b2..d469d6e 100644
--- a/sys/contrib/dev/acpica/components/events/evregion.c
+++ b/sys/contrib/dev/acpica/components/events/evregion.c
@@ -234,18 +234,12 @@ AcpiEvAddressSpaceDispatch (
{
RegionObj->Region.Flags |= AOPOBJ_SETUP_COMPLETE;
- if (RegionObj2->Extra.RegionContext)
- {
- /* The handler for this region was already installed */
-
- ACPI_FREE (RegionContext);
- }
- else
+ /*
+ * Save the returned context for use in all accesses to
+ * the handler for this particular region
+ */
+ if (!(RegionObj2->Extra.RegionContext))
{
- /*
- * Save the returned context for use in all accesses to
- * this particular region
- */
RegionObj2->Extra.RegionContext = RegionContext;
}
}
@@ -261,7 +255,6 @@ AcpiEvAddressSpaceDispatch (
ACPI_FORMAT_NATIVE_UINT (RegionObj->Region.Address + RegionOffset),
AcpiUtGetRegionName (RegionObj->Region.SpaceId)));
-
/*
* Special handling for GenericSerialBus and GeneralPurposeIo:
* There are three extra parameters that must be passed to the
@@ -424,6 +417,15 @@ AcpiEvDetachRegion(
Status = RegionSetup (RegionObj, ACPI_REGION_DEACTIVATE,
HandlerObj->AddressSpace.Context, RegionContext);
+ /*
+ * RegionContext should have been released by the deactivate
+ * operation. We don't need access to it anymore here.
+ */
+ if (RegionContext)
+ {
+ *RegionContext = NULL;
+ }
+
/* Init routine may fail, Just ignore errors */
if (ACPI_FAILURE (Status))
OpenPOWER on IntegriCloud