Angel Pons has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/58908 )
Change subject: drivers: Replace bad uses of `find_resource` ......................................................................
drivers: 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: Ia9a4b62c857f7362d67aee4f9de3bb2da1838394 Signed-off-by: Angel Pons th3fanbus@gmail.com --- M src/drivers/aspeed/common/ast_mode_corebootfb.c M src/drivers/net/atl1e.c M src/drivers/uart/oxpcie.c M src/drivers/usb/pci_ehci.c 4 files changed, 4 insertions(+), 4 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/08/58908/1
diff --git a/src/drivers/aspeed/common/ast_mode_corebootfb.c b/src/drivers/aspeed/common/ast_mode_corebootfb.c index b25d742..6c63931 100644 --- a/src/drivers/aspeed/common/ast_mode_corebootfb.c +++ b/src/drivers/aspeed/common/ast_mode_corebootfb.c @@ -22,7 +22,7 @@ struct drm_framebuffer *fb = crtc->primary->fb;
/* PCI BAR 0 */ - struct resource *res = find_resource(crtc->dev->pdev, PCI_BASE_ADDRESS_0); + struct resource *res = probe_resource(crtc->dev->pdev, PCI_BASE_ADDRESS_0); if (!res) { printk(BIOS_ERR, "BAR0 resource not found.\n"); return -EIO; diff --git a/src/drivers/net/atl1e.c b/src/drivers/net/atl1e.c index 97ad140..d5e0cdd 100644 --- a/src/drivers/net/atl1e.c +++ b/src/drivers/net/atl1e.c @@ -106,7 +106,7 @@ static void atl1e_init(struct device *dev) { /* Get the resource of the NIC mmio */ - struct resource *nic_res = find_resource(dev, PCI_BASE_ADDRESS_0); + struct resource *nic_res = probe_resource(dev, PCI_BASE_ADDRESS_0);
if (nic_res == NULL) { printk(BIOS_ERR, "atl1e: resource not found\n"); diff --git a/src/drivers/uart/oxpcie.c b/src/drivers/uart/oxpcie.c index 8ba39ef..59e8ff2 100644 --- a/src/drivers/uart/oxpcie.c +++ b/src/drivers/uart/oxpcie.c @@ -12,7 +12,7 @@ { printk(BIOS_DEBUG, "Initializing Oxford OXPCIe952\n");
- struct resource *res = find_resource(dev, PCI_BASE_ADDRESS_0); + struct resource *res = probe_resource(dev, PCI_BASE_ADDRESS_0); if (!res) { printk(BIOS_WARNING, "OXPCIe952: No UART resource found.\n"); return; diff --git a/src/drivers/usb/pci_ehci.c b/src/drivers/usb/pci_ehci.c index d59ca32..8e85426 100644 --- a/src/drivers/usb/pci_ehci.c +++ b/src/drivers/usb/pci_ehci.c @@ -75,7 +75,7 @@
if (ehci_drv_ops->set_resources) ehci_drv_ops->set_resources(dev); - res = find_resource(dev, EHCI_BAR_INDEX); + res = probe_resource(dev, EHCI_BAR_INDEX); if (!res) return;