Felix Held submitted this change.

View Change

Approvals: build bot (Jenkins): Verified Felix Held: Looks good to me, approved Furquan Shaikh: Looks good to me, approved
soc/amd/common: Don't program GPIOs if the table isn't set

Currently, there's no check for the table being programmed. This skips
programming a table if the table size is zero, or the pointer to the
table has been set to NULL.

BUG=None
TEST=Set table pointer to NULL, table doesn't run.
BRANCH=Zork

Signed-off-by: Martin Roth <martinroth@chromium.org>
Change-Id: I7d09b47e7d619428b64cc0695f220fb64c71ef4c
Reviewed-on: https://review.coreboot.org/c/coreboot/+/47307
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Felix Held <felix-coreboot@felixheld.de>
Reviewed-by: Furquan Shaikh <furquan@google.com>
---
M src/soc/amd/common/block/gpio_banks/gpio.c
1 file changed, 2 insertions(+), 0 deletions(-)

diff --git a/src/soc/amd/common/block/gpio_banks/gpio.c b/src/soc/amd/common/block/gpio_banks/gpio.c
index 74ea696..91773d9 100644
--- a/src/soc/amd/common/block/gpio_banks/gpio.c
+++ b/src/soc/amd/common/block/gpio_banks/gpio.c
@@ -187,6 +187,8 @@
size_t gev_items;
const bool can_set_smi_flags = !(CONFIG(VBOOT_STARTS_BEFORE_BOOTBLOCK) &&
ENV_SEPARATE_VERSTAGE);
+ if (!gpio_list_ptr || !size)
+ return;

/*
* Disable blocking wake/interrupt status generation while updating

To view, visit change 47307. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: I7d09b47e7d619428b64cc0695f220fb64c71ef4c
Gerrit-Change-Number: 47307
Gerrit-PatchSet: 2
Gerrit-Owner: Martin Roth <martinroth@google.com>
Gerrit-Reviewer: Felix Held <felix-coreboot@felixheld.de>
Gerrit-Reviewer: Furquan Shaikh <furquan@google.com>
Gerrit-Reviewer: build bot (Jenkins) <no-reply@coreboot.org>
Gerrit-CC: Peichao Wang <pwang12@lenovo.corp-partner.google.com>
Gerrit-MessageType: merged