treewide: Replace bad uses of find_resource

The `find_resource` function will never return null (will die instead).
In cases where the existing code already accounts for null pointers, it
is better to use `probe_resource` instead, which returns a null pointer
instead of dying.

Change-Id: I329efcb42a444b097794fde4f40acf5ececaea8c
Signed-off-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/58910
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Werner Zeh <werner.zeh@siemens.com>
Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
Reviewed-by: Lance Zhao
This commit is contained in:
Angel Pons
2021-11-03 13:27:45 +01:00
committed by Felix Held
parent c167b74868
commit 32d09be655
3 changed files with 3 additions and 3 deletions

View File

@@ -1248,7 +1248,7 @@ unsigned long acpi_write_dbg2_pci_uart(acpi_rsdp_t *rsdp, unsigned long current,
printk(BIOS_INFO, "%s: Device not enabled\n", __func__);
return current;
}
res = find_resource(dev, PCI_BASE_ADDRESS_0);
res = probe_resource(dev, PCI_BASE_ADDRESS_0);
if (!res) {
printk(BIOS_ERR, "%s: Unable to find resource for %s\n",
__func__, dev_path(dev));

View File

@@ -285,7 +285,7 @@ void azalia_audio_init(struct device *dev)
struct resource *res;
u16 codec_mask;
res = find_resource(dev, PCI_BASE_ADDRESS_0);
res = probe_resource(dev, PCI_BASE_ADDRESS_0);
if (!res)
return;

View File

@@ -229,7 +229,7 @@ static void mainboard_final(void *chip_info)
dev = pcidev_path_on_root(PCH_DEVFN_SDCARD);
if (dev) {
uint32_t reg;
struct resource *res = find_resource(dev, PCI_BASE_ADDRESS_0);
struct resource *res = probe_resource(dev, PCI_BASE_ADDRESS_0);
if (!res)
return;