diff options
author | Felix Held <felix-coreboot@felixheld.de> | 2022-12-15 15:26:28 +0100 |
---|---|---|
committer | Fred Reitberger <reitbergerfred@gmail.com> | 2022-12-16 15:32:02 +0000 |
commit | d832bda32bd54b65c41db4ae945fb6a993ca055b (patch) | |
tree | 2c8ce3b99421a6a5d4af3f93abfdd023601be6cb /src/soc/amd | |
parent | f3c107eb01cae5347b487d75462e36a455f9ec48 (diff) |
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>
Diffstat (limited to 'src/soc/amd')
-rw-r--r-- | src/soc/amd/common/block/i2c/i2c.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/soc/amd/common/block/i2c/i2c.c b/src/soc/amd/common/block/i2c/i2c.c index 30e02ee07d..617b8b7e10 100644 --- a/src/soc/amd/common/block/i2c/i2c.c +++ b/src/soc/amd/common/block/i2c/i2c.c @@ -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) |