soc/amd/common/block/i2c: don't call die() when MMIO address is NULL

There's no need to call die() in the case that the MMIO address of the
I2C controller is NULL, so handle this case by returning a failure
instead.

Signed-off-by: Felix Held <felix-coreboot@felixheld.de>
Change-Id: I12c143916ad551c56cc4ff75ae23754018817505
Reviewed-on: https://review.coreboot.org/c/coreboot/+/70827
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Fred Reitberger <reitbergerfred@gmail.com>
Reviewed-by: Martin Roth <martin.roth@amd.corp-partner.google.com>
Reviewed-by: Matt DeVillier <matt.devillier@amd.corp-partner.google.com>
Reviewed-by: Eric Lai <eric_lai@quanta.corp-partner.google.com>
This commit is contained in:
Felix Held 2022-12-15 15:26:28 +01:00 committed by Fred Reitberger
parent f3c107eb01
commit d832bda32b
1 changed files with 8 additions and 4 deletions

View File

@ -49,8 +49,10 @@ static const char *i2c_acpi_name(const struct device *dev)
size_t num_ctrlrs;
const struct soc_i2c_ctrlr_info *ctrlr = soc_get_i2c_ctrlr_info(&num_ctrlrs);
if (!(uintptr_t)dev->path.mmio.addr)
die("NULL MMIO address at %s\n", __func__);
if (!(uintptr_t)dev->path.mmio.addr) {
printk(BIOS_ERR, "NULL MMIO address at %s\n", __func__);
return NULL;
}
for (i = 0; i < num_ctrlrs; i++) {
if ((uintptr_t)dev->path.mmio.addr == ctrlr[i].bar)
@ -66,8 +68,10 @@ int dw_i2c_soc_dev_to_bus(const struct device *dev)
size_t num_ctrlrs;
const struct soc_i2c_ctrlr_info *ctrlr = soc_get_i2c_ctrlr_info(&num_ctrlrs);
if (!(uintptr_t)dev->path.mmio.addr)
die("NULL MMIO address at %s\n", __func__);
if (!(uintptr_t)dev->path.mmio.addr) {
printk(BIOS_ERR, "NULL MMIO address at %s\n", __func__);
return -1;
}
for (i = 0; i < num_ctrlrs; i++) {
if ((uintptr_t)dev->path.mmio.addr == ctrlr[i].bar)