summaryrefslogtreecommitdiff
path: root/source/os_specific/service_layers/oswintbl.c
diff options
context:
space:
mode:
Diffstat (limited to 'source/os_specific/service_layers/oswintbl.c')
-rw-r--r--source/os_specific/service_layers/oswintbl.c26
1 files changed, 16 insertions, 10 deletions
diff --git a/source/os_specific/service_layers/oswintbl.c b/source/os_specific/service_layers/oswintbl.c
index daff7fe5d2c01..0afde6874f6a2 100644
--- a/source/os_specific/service_layers/oswintbl.c
+++ b/source/os_specific/service_layers/oswintbl.c
@@ -222,6 +222,7 @@ AcpiOsGetTableByName (
HKEY SubKey;
ULONG i;
ACPI_TABLE_HEADER *ReturnTable;
+ ACPI_STATUS Status = AE_OK;
/*
@@ -294,7 +295,8 @@ AcpiOsGetTableByName (
{
fprintf (stderr, "Could not open %s entry: %s\n",
Signature, WindowsFormatException (WinStatus));
- return (AE_ERROR);
+ Status = AE_ERROR;
+ goto Cleanup;
}
RegCloseKey (Handle);
@@ -313,7 +315,8 @@ AcpiOsGetTableByName (
{
fprintf (stderr, "Could not get %s registry entry: %s\n",
Signature, WindowsFormatException (WinStatus));
- return (AE_ERROR);
+ Status = AE_ERROR;
+ goto Cleanup;
}
if (Type == REG_BINARY)
@@ -326,11 +329,12 @@ AcpiOsGetTableByName (
WinStatus = RegQueryValueEx (Handle, KeyBuffer, NULL, NULL,
NULL, &DataSize);
- if (WinStatus != ERROR_SUCCESS)
+ if (WinStatus = ERROR_SUCCESS)
{
fprintf (stderr, "Could not read the %s table size: %s\n",
Signature, WindowsFormatException (WinStatus));
- return (AE_ERROR);
+ Status = AE_ERROR;
+ goto Cleanup;
}
/* Allocate a new buffer for the table */
@@ -338,6 +342,7 @@ AcpiOsGetTableByName (
ReturnTable = malloc (DataSize);
if (!ReturnTable)
{
+ Status = AE_NO_MEMORY;
goto Cleanup;
}
@@ -345,20 +350,21 @@ AcpiOsGetTableByName (
WinStatus = RegQueryValueEx (Handle, KeyBuffer, NULL, NULL,
(UCHAR *) ReturnTable, &DataSize);
- if (WinStatus != ERROR_SUCCESS)
+ if (WinStatus = ERROR_SUCCESS)
{
fprintf (stderr, "Could not read %s data: %s\n",
Signature, WindowsFormatException (WinStatus));
free (ReturnTable);
- return (AE_ERROR);
+ Status = AE_ERROR;
+ goto Cleanup;
}
-Cleanup:
- RegCloseKey (Handle);
-
*Table = ReturnTable;
*Address = 0;
- return (AE_OK);
+
+Cleanup:
+ RegCloseKey (Handle);
+ return (Status);
}