summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authornjl <njl@FreeBSD.org>2003-12-23 18:47:31 +0000
committernjl <njl@FreeBSD.org>2003-12-23 18:47:31 +0000
commit8a8dfa84e91d3434b7d892c898fbcfe158100e40 (patch)
treee042b9d9e6cc6bded665791f29525eb27851466e /sys
parent151da8eaf658c48df2a2a0b39f2d66a9400acdc9 (diff)
downloadFreeBSD-src-8a8dfa84e91d3434b7d892c898fbcfe158100e40.zip
FreeBSD-src-8a8dfa84e91d3434b7d892c898fbcfe158100e40.tar.gz
Fix locking broken by recent _CID changes. Always be sure to unlock
in the error case.
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/acpica/acpi.c25
1 files changed, 15 insertions, 10 deletions
diff --git a/sys/dev/acpica/acpi.c b/sys/dev/acpica/acpi.c
index 151587e..d9de241 100644
--- a/sys/dev/acpica/acpi.c
+++ b/sys/dev/acpica/acpi.c
@@ -813,22 +813,25 @@ acpi_isa_get_logicalid(device_t dev)
ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__);
pnpid = 0;
+ buf.Pointer = NULL;
+ buf.Length = ACPI_ALLOCATE_BUFFER;
+
ACPI_LOCK;
/* Fetch and validate the HID. */
if ((h = acpi_get_handle(dev)) == NULL)
- return (0);
- buf.Pointer = NULL;
- buf.Length = ACPI_ALLOCATE_BUFFER;
+ goto out;
error = AcpiGetObjectInfo(h, &buf);
if (ACPI_FAILURE(error))
- return (0);
+ goto out;
devinfo = (ACPI_DEVICE_INFO *)buf.Pointer;
if ((devinfo->Valid & ACPI_VALID_HID) != 0)
pnpid = PNP_EISAID(devinfo->HardwareId.Value);
- AcpiOsFree(buf.Pointer);
+out:
+ if (buf.Pointer != NULL)
+ AcpiOsFree(buf.Pointer);
ACPI_UNLOCK;
return_VALUE (pnpid);
}
@@ -848,16 +851,17 @@ acpi_isa_get_compatid(device_t dev, uint32_t *cids, int count)
pnpid = cids;
valid = 0;
+ buf.Pointer = NULL;
+ buf.Length = ACPI_ALLOCATE_BUFFER;
+
ACPI_LOCK;
/* Fetch and validate the CID */
if ((h = acpi_get_handle(dev)) == NULL)
- return (0);
- buf.Pointer = NULL;
- buf.Length = ACPI_ALLOCATE_BUFFER;
+ goto out;
error = AcpiGetObjectInfo(h, &buf);
if (ACPI_FAILURE(error))
- return (0);
+ goto out;
devinfo = (ACPI_DEVICE_INFO *)buf.Pointer;
if ((devinfo->Valid & ACPI_VALID_CID) == 0)
goto out;
@@ -872,7 +876,8 @@ acpi_isa_get_compatid(device_t dev, uint32_t *cids, int count)
}
out:
- AcpiOsFree(buf.Pointer);
+ if (buf.Pointer != NULL)
+ AcpiOsFree(buf.Pointer);
ACPI_UNLOCK;
return_VALUE (valid);
}
OpenPOWER on IntegriCloud