From 4523df8fee2c8e045b47c5c73fe6f1760516a555 Mon Sep 17 00:00:00 2001 From: Patrick Georgi Date: Mon, 9 Sep 2019 22:28:28 +0200 Subject: chip/stm/i2c-stm32f4: Remove constant conditionals rv_start is effectively constant (and 0) after goto xfer_exit, so the conditionals aren't needed. Found by Coverity Scan #157505 BUG=none BRANCH=none TEST=none Change-Id: Id7d2445615ae0f1230a9245f0baf9b9ea1d9a80a Signed-off-by: Patrick Georgi Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1793582 Tested-by: Patrick Georgi Commit-Queue: Patrick Georgi Reviewed-by: Daisuke Nojiri --- chip/stm32/i2c-stm32f4.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/chip/stm32/i2c-stm32f4.c b/chip/stm32/i2c-stm32f4.c index 1fe95d1722..aa4a363e54 100644 --- a/chip/stm32/i2c-stm32f4.c +++ b/chip/stm32/i2c-stm32f4.c @@ -458,15 +458,13 @@ static int chip_fmpi2c_xfer(const int port, const uint16_t slave_addr_8bit, goto xfer_exit; STM32_FMPI2C_CR1(port) |= FMPI2C_CR1_RXDMAEN; - if (!rv_start) { - rv = task_wait_event_mask( - TASK_EVENT_I2C_COMPLETION(port), - DMA_TRANSFER_TIMEOUT_US); - if (rv & TASK_EVENT_I2C_COMPLETION(port)) - rv = EC_SUCCESS; - else - rv = EC_ERROR_TIMEOUT; - } + rv = task_wait_event_mask( + TASK_EVENT_I2C_COMPLETION(port), + DMA_TRANSFER_TIMEOUT_US); + if (rv & TASK_EVENT_I2C_COMPLETION(port)) + rv = EC_SUCCESS; + else + rv = EC_ERROR_TIMEOUT; dma_disable(dma->channel); dma_disable_tc_interrupt(dma->channel); @@ -476,9 +474,6 @@ static int chip_fmpi2c_xfer(const int port, const uint16_t slave_addr_8bit, rv = wait_fmpi2c_isr(port, FMPI2C_ISR_STOPF); STM32_FMPI2C_CR1(port) &= ~FMPI2C_CR1_RXDMAEN; - - if (rv_start) - rv = rv_start; } xfer_exit: -- cgit v1.2.1