Felix Held has submitted this change. ( https://review.coreboot.org/c/coreboot/+/58906 )
Change subject: nb/intel: Replace bad uses of `find_resource` ......................................................................
nb/intel: 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: I617fea8a09049e9a87130640835ea6c3e2faec60 Signed-off-by: Angel Pons th3fanbus@gmail.com Reviewed-on: https://review.coreboot.org/c/coreboot/+/58906 Tested-by: build bot (Jenkins) no-reply@coreboot.org Reviewed-by: Werner Zeh werner.zeh@siemens.com --- M src/northbridge/intel/gm45/gma.c M src/northbridge/intel/haswell/gma.c M src/northbridge/intel/haswell/minihd.c M src/northbridge/intel/ironlake/gma.c M src/northbridge/intel/sandybridge/gma.c 5 files changed, 6 insertions(+), 6 deletions(-)
Approvals: build bot (Jenkins): Verified Werner Zeh: Looks good to me, approved
diff --git a/src/northbridge/intel/gm45/gma.c b/src/northbridge/intel/gm45/gma.c index 178149d..77bbe3f 100644 --- a/src/northbridge/intel/gm45/gma.c +++ b/src/northbridge/intel/gm45/gma.c @@ -151,7 +151,7 @@
intel_gma_init_igd_opregion();
- gtt_res = find_resource(dev, PCI_BASE_ADDRESS_0); + gtt_res = probe_resource(dev, PCI_BASE_ADDRESS_0); if (gtt_res == NULL) return; mmio = res2mmio(gtt_res, 0, 0); diff --git a/src/northbridge/intel/haswell/gma.c b/src/northbridge/intel/haswell/gma.c index ccabb8c..212b395 100644 --- a/src/northbridge/intel/haswell/gma.c +++ b/src/northbridge/intel/haswell/gma.c @@ -178,7 +178,7 @@ { printk(BIOS_DEBUG, "GT Power Management Init\n");
- gtt_res = find_resource(dev, PCI_BASE_ADDRESS_0); + gtt_res = probe_resource(dev, PCI_BASE_ADDRESS_0); if (!gtt_res || !gtt_res->base) return;
diff --git a/src/northbridge/intel/haswell/minihd.c b/src/northbridge/intel/haswell/minihd.c index 1bfbfe5..6896464 100644 --- a/src/northbridge/intel/haswell/minihd.c +++ b/src/northbridge/intel/haswell/minihd.c @@ -51,7 +51,7 @@ int codec_mask, i;
/* Find base address */ - res = find_resource(dev, PCI_BASE_ADDRESS_0); + res = probe_resource(dev, PCI_BASE_ADDRESS_0); if (!res) return;
diff --git a/src/northbridge/intel/ironlake/gma.c b/src/northbridge/intel/ironlake/gma.c index 7d08f31..a0325d1 100644 --- a/src/northbridge/intel/ironlake/gma.c +++ b/src/northbridge/intel/ironlake/gma.c @@ -140,7 +140,7 @@ if (!CONFIG(NO_GFX_INIT)) pci_or_config16(dev, PCI_COMMAND, PCI_COMMAND_MASTER);
- gtt_res = find_resource(dev, PCI_BASE_ADDRESS_0); + gtt_res = probe_resource(dev, PCI_BASE_ADDRESS_0); if (!gtt_res || !gtt_res->base) return;
@@ -171,7 +171,7 @@ struct resource *res;
/* Set the graphics memory to write combining. */ - res = find_resource(dev, PCI_BASE_ADDRESS_2); + res = probe_resource(dev, PCI_BASE_ADDRESS_2); if (res == NULL) { printk(BIOS_DEBUG, "gma: memory resource not found.\n"); return; diff --git a/src/northbridge/intel/sandybridge/gma.c b/src/northbridge/intel/sandybridge/gma.c index 38adbce..9d01533 100644 --- a/src/northbridge/intel/sandybridge/gma.c +++ b/src/northbridge/intel/sandybridge/gma.c @@ -308,7 +308,7 @@
printk(BIOS_DEBUG, "GT Power Management Init\n");
- gtt_res = find_resource(dev, PCI_BASE_ADDRESS_0); + gtt_res = probe_resource(dev, PCI_BASE_ADDRESS_0); if (!gtt_res || !gtt_res->base) return;