diff options
author | Angel Pons <th3fanbus@gmail.com> | 2021-11-03 13:18:53 +0100 |
---|---|---|
committer | Felix Held <felix-coreboot@felixheld.de> | 2021-11-04 17:34:30 +0000 |
commit | c1bfbe03a2d379d6859734da445a8ab3fd292305 (patch) | |
tree | c06cef86fb068c718e7a4b60ef5620e46a31fdd8 /src/soc/intel/braswell | |
parent | 536d36a7480c70acefb45c7f31db29489f4776e8 (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/braswell')
-rw-r--r-- | src/soc/intel/braswell/lpe.c | 6 | ||||
-rw-r--r-- | src/soc/intel/braswell/lpss.c | 4 | ||||
-rw-r--r-- | src/soc/intel/braswell/scc.c | 4 |
3 files changed, 7 insertions, 7 deletions
diff --git a/src/soc/intel/braswell/lpe.c b/src/soc/intel/braswell/lpe.c index 59cabee707..323c9fc175 100644 --- a/src/soc/intel/braswell/lpe.c +++ b/src/soc/intel/braswell/lpe.c @@ -35,7 +35,7 @@ static void assign_device_nvs(struct device *dev, u32 *field, { struct resource *res; - res = find_resource(dev, index); + res = probe_resource(dev, index); if (res) *field = res->base; } @@ -109,7 +109,7 @@ static void lpe_stash_firmware_info(struct device *dev) struct resource *res; struct resource *mmio; - res = find_resource(dev, FIRMWARE_PCI_REG_BASE); + res = probe_resource(dev, FIRMWARE_PCI_REG_BASE); if (res == NULL) { printk(BIOS_DEBUG, "LPE Firmware memory not found.\n"); return; @@ -162,7 +162,7 @@ static void lpe_set_resources(struct device *dev) { struct resource *res; - res = find_resource(dev, PCI_BASE_ADDRESS_2); + res = probe_resource(dev, PCI_BASE_ADDRESS_2); if (res != NULL) res->flags |= IORESOURCE_STORED; diff --git a/src/soc/intel/braswell/lpss.c b/src/soc/intel/braswell/lpss.c index 93ee3da273..5f93e17206 100644 --- a/src/soc/intel/braswell/lpss.c +++ b/src/soc/intel/braswell/lpss.c @@ -31,11 +31,11 @@ static void dev_enable_acpi_mode(struct device *dev, int iosf_reg, int nvs_index struct device_nvs *dev_nvs = acpi_get_device_nvs(); /* Save BAR0 and BAR1 to ACPI NVS */ - bar = find_resource(dev, PCI_BASE_ADDRESS_0); + bar = probe_resource(dev, PCI_BASE_ADDRESS_0); if (bar) dev_nvs->lpss_bar0[nvs_index] = (u32)bar->base; - bar = find_resource(dev, PCI_BASE_ADDRESS_1); + bar = probe_resource(dev, PCI_BASE_ADDRESS_1); if (bar) dev_nvs->lpss_bar1[nvs_index] = (u32)bar->base; diff --git a/src/soc/intel/braswell/scc.c b/src/soc/intel/braswell/scc.c index 902ee57a11..8894aa5c75 100644 --- a/src/soc/intel/braswell/scc.c +++ b/src/soc/intel/braswell/scc.c @@ -13,10 +13,10 @@ void scc_enable_acpi_mode(struct device *dev, int iosf_reg, int nvs_index) struct device_nvs *dev_nvs = acpi_get_device_nvs(); /* Save BAR0 and BAR1 to ACPI NVS */ - bar = find_resource(dev, PCI_BASE_ADDRESS_0); + bar = probe_resource(dev, PCI_BASE_ADDRESS_0); if (bar) dev_nvs->scc_bar0[nvs_index] = bar->base; - bar = find_resource(dev, PCI_BASE_ADDRESS_2); + bar = probe_resource(dev, PCI_BASE_ADDRESS_2); if (bar) dev_nvs->scc_bar1[nvs_index] = bar->base; |