summaryrefslogtreecommitdiff
path: root/src/soc/intel/broadwell/pch
diff options
context:
space:
mode:
authorAngel Pons <th3fanbus@gmail.com>2021-11-03 13:18:53 +0100
committerFelix Held <felix-coreboot@felixheld.de>2021-11-04 17:34:30 +0000
commitc1bfbe03a2d379d6859734da445a8ab3fd292305 (patch)
treec06cef86fb068c718e7a4b60ef5620e46a31fdd8 /src/soc/intel/broadwell/pch
parent536d36a7480c70acefb45c7f31db29489f4776e8 (diff)
soc/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: I2a57ea1c2f5b156afd0724829e5b1880246f351f Signed-off-by: Angel Pons <th3fanbus@gmail.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/58907 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Werner Zeh <werner.zeh@siemens.com> Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
Diffstat (limited to 'src/soc/intel/broadwell/pch')
-rw-r--r--src/soc/intel/broadwell/pch/adsp.c4
-rw-r--r--src/soc/intel/broadwell/pch/hda.c2
-rw-r--r--src/soc/intel/broadwell/pch/me.c2
-rw-r--r--src/soc/intel/broadwell/pch/serialio.c4
4 files changed, 6 insertions, 6 deletions
diff --git a/src/soc/intel/broadwell/pch/adsp.c b/src/soc/intel/broadwell/pch/adsp.c
index 1ebf922aec..eaae08b881 100644
--- a/src/soc/intel/broadwell/pch/adsp.c
+++ b/src/soc/intel/broadwell/pch/adsp.c
@@ -25,10 +25,10 @@ static void adsp_init(struct device *dev)
pci_or_config16(dev, PCI_COMMAND, PCI_COMMAND_MASTER | PCI_COMMAND_MEMORY);
/* Find BAR0 and BAR1 */
- bar0 = find_resource(dev, PCI_BASE_ADDRESS_0);
+ bar0 = probe_resource(dev, PCI_BASE_ADDRESS_0);
if (!bar0)
return;
- bar1 = find_resource(dev, PCI_BASE_ADDRESS_1);
+ bar1 = probe_resource(dev, PCI_BASE_ADDRESS_1);
if (!bar1)
return;
diff --git a/src/soc/intel/broadwell/pch/hda.c b/src/soc/intel/broadwell/pch/hda.c
index 2e00f79bb8..37f2d9f8e6 100644
--- a/src/soc/intel/broadwell/pch/hda.c
+++ b/src/soc/intel/broadwell/pch/hda.c
@@ -80,7 +80,7 @@ static void hda_init(struct device *dev)
u32 codec_mask;
/* 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/soc/intel/broadwell/pch/me.c b/src/soc/intel/broadwell/pch/me.c
index 22db6a72f9..95b6d889d2 100644
--- a/src/soc/intel/broadwell/pch/me.c
+++ b/src/soc/intel/broadwell/pch/me.c
@@ -709,7 +709,7 @@ static int intel_mei_setup(struct device *dev)
struct mei_csr host;
/* Find the MMIO base for the ME interface */
- res = find_resource(dev, PCI_BASE_ADDRESS_0);
+ res = probe_resource(dev, PCI_BASE_ADDRESS_0);
if (!res || res->base == 0 || res->size == 0) {
printk(BIOS_DEBUG, "ME: MEI resource not present!\n");
return -1;
diff --git a/src/soc/intel/broadwell/pch/serialio.c b/src/soc/intel/broadwell/pch/serialio.c
index e38de5eda1..f87217c070 100644
--- a/src/soc/intel/broadwell/pch/serialio.c
+++ b/src/soc/intel/broadwell/pch/serialio.c
@@ -166,10 +166,10 @@ static void serialio_init(struct device *dev)
pci_or_config16(dev, PCI_COMMAND, PCI_COMMAND_MASTER | PCI_COMMAND_MEMORY);
/* Find BAR0 and BAR1 */
- bar0 = find_resource(dev, PCI_BASE_ADDRESS_0);
+ bar0 = probe_resource(dev, PCI_BASE_ADDRESS_0);
if (!bar0)
return;
- bar1 = find_resource(dev, PCI_BASE_ADDRESS_1);
+ bar1 = probe_resource(dev, PCI_BASE_ADDRESS_1);
if (!bar1)
return;