- Prefer ACPI_COMPARE_NAME(a, b) macro over strncmp(a, b, ACPI_NAME_SIZE).
- Make sure the predefined name is a string type. - Return slightly more useful errors.
This commit is contained in:
parent
ec23b5bfe7
commit
b3f35be0c6
@ -54,8 +54,8 @@ AcpiOsPredefinedOverride(const ACPI_PREDEFINED_NAMES *InitVal,
|
||||
return (AE_BAD_PARAMETER);
|
||||
|
||||
*NewVal = NULL;
|
||||
if (strncmp(InitVal->Name, "_OS_", ACPI_NAME_SIZE) == 0 &&
|
||||
strlen(acpi_osname) > 0) {
|
||||
if (ACPI_COMPARE_NAME(InitVal->Name, "_OS_") &&
|
||||
InitVal->Type == ACPI_TYPE_STRING && strlen(acpi_osname) > 0) {
|
||||
printf("ACPI: Overriding _OS definition with \"%s\"\n",
|
||||
acpi_osname);
|
||||
*NewVal = acpi_osname;
|
||||
@ -80,18 +80,17 @@ AcpiOsTableOverride(ACPI_TABLE_HEADER *ExistingTable,
|
||||
for (int i = 0; i < ACPI_NAME_SIZE; i++)
|
||||
modname[i + 5] = tolower(ExistingTable->Signature[i]);
|
||||
#else
|
||||
/* If we're not overriding the DSDT, just return. */
|
||||
if (strncmp(ExistingTable->Signature, ACPI_SIG_DSDT,
|
||||
ACPI_NAME_SIZE) != 0)
|
||||
return (AE_OK);
|
||||
if (!ACPI_COMPARE_NAME(ExistingTable->Signature, ACPI_SIG_DSDT))
|
||||
return (AE_SUPPORT);
|
||||
#endif
|
||||
acpi_table = preload_search_by_type(modname);
|
||||
if (acpi_table == NULL)
|
||||
return (AE_OK);
|
||||
return (AE_NOT_FOUND);
|
||||
hdr = preload_fetch_addr(acpi_table);
|
||||
sz = preload_fetch_size(acpi_table);
|
||||
if (hdr != NULL && sz != 0)
|
||||
*NewTable = hdr;
|
||||
if (hdr == NULL || sz == 0)
|
||||
return (AE_ERROR);
|
||||
*NewTable = hdr;
|
||||
return (AE_OK);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user