npcx: avoid invalid VW signal index
Prevent possibility of array[-1] access
BRANCH=none
TEST=none
Code-Coverage: Zoss
@@ -274,6 +274,9 @@ void espi_wait_vw_not_dirty(enum espi_vw_signal signal, unsigned int timeout_us)
uint64_t timeout;
sig_idx = espi_vw_get_signal_index(signal);
+ /* Cannot find signal index */
+ if (sig_idx < 0)
+ return;
for (offset = 0; offset < ESPI_VWEVSM_NUM; offset++) {
uint8_t vw_idx = VWEVSM_IDX_GET(NPCX_VWEVSM(offset));
