acpi/device: Only return dev->ops->acpi_name if non-NULL

Returning a NULL device name can cause issues if something else does
handle it.

E.g. UART and GNA devices on Intel Alder Lake-N cause
INTERNAL_POWER_ERROR BSOD's in Windows when enabled due to invalid
packages being created from a NULL name

Test: build/boot google/nissa (craaskvin) to Win11

Change-Id: I0679147ad3e330d706bbf97c30bc11b2432e2e8a
Signed-off-by: CoolStar <coolstarorganization@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/77413
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Matt DeVillier <matt.devillier@gmail.com>
Reviewed-by: Felix Singer <service+coreboot-gerrit@felixsinger.de>
This commit is contained in:
CoolStar 2023-08-24 02:00:50 -07:00 committed by Matt DeVillier
parent 31327d8b4b
commit 42be899b65
1 changed files with 5 additions and 2 deletions

View File

@ -76,8 +76,11 @@ const char *acpi_device_name(const struct device *dev)
return NULL;
/* Check for device specific handler */
if (dev->ops && dev->ops->acpi_name)
return dev->ops->acpi_name(dev);
if (dev->ops && dev->ops->acpi_name) {
name = dev->ops->acpi_name(dev);
if (name)
return name;
}
/* Walk up the tree to find if any parent can identify this device */
while (pdev->bus) {