diff options
author | Caveh Jalali <caveh@chromium.org> | 2023-04-28 00:29:25 -0700 |
---|---|---|
committer | Chromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2023-04-28 22:09:44 +0000 |
commit | 8287fbf5f011b97eae51c542fd750324c04aa0cf (patch) | |
tree | a2af70e377188794e81f2b02a3a69ceb5c73feca | |
parent | 0a47a7b0d25eb496ab5525dfb8e577057de086f0 (diff) | |
download | chrome-ec-8287fbf5f011b97eae51c542fd750324c04aa0cf.tar.gz |
rex: Only reset TCPC when rst_gpio defined
Some rex SKUs do not have a reset pin for the TCPC on port C1,
so don't try to access a non existing pin. This was resulting
in a null pointer dereference.
BRANCH=none
BUG=b:267589042,b:278217028
TEST=no more reboots on rex SKU3
LOW_COVERAGE_REASON=early-phase platform, b/247796816
Change-Id: I07f5dd5a1b13b2dbf7109dd1f5101679d91638a3
Signed-off-by: Caveh Jalali <caveh@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4486441
Reviewed-by: Keith Short <keithshort@chromium.org>
-rw-r--r-- | zephyr/program/rex/src/usbc_config.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/zephyr/program/rex/src/usbc_config.c b/zephyr/program/rex/src/usbc_config.c index e2fe1b929c..ea868a496f 100644 --- a/zephyr/program/rex/src/usbc_config.c +++ b/zephyr/program/rex/src/usbc_config.c @@ -115,10 +115,12 @@ void board_reset_pd_mcu(void) reset_nct38xx_port(USBC_PORT_C0); /* Reset TCPC1 */ - gpio_pin_set_dt(&tcpc_config[1].rst_gpio, 1); - msleep(PS8XXX_RESET_DELAY_MS); - gpio_pin_set_dt(&tcpc_config[1].rst_gpio, 0); - msleep(PS8815_FW_INIT_DELAY_MS); + if (tcpc_config[1].rst_gpio.port) { + gpio_pin_set_dt(&tcpc_config[1].rst_gpio, 1); + msleep(PS8XXX_RESET_DELAY_MS); + gpio_pin_set_dt(&tcpc_config[1].rst_gpio, 0); + msleep(PS8815_FW_INIT_DELAY_MS); + } } void ppc_interrupt(enum gpio_signal signal) |