Skip to contentSkip to conversation

spi-stm32: fix Coccinelle warnings

PATCH In review CGEL 2 participants 2 messages Aug 20, 2021

Subsystems (3)
lore
Share & tools
lore

CGEL

author
#0 lore raw

PATCH 1/1 spi-stm32: fix Coccinelle warnings

From: jing yangyang <[email protected]>

WARNING !A || A && B is equivalent to !A || B

This issue was detected with the help of Coccinelle.

---
 drivers/spi/spi-stm32.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/spi/spi-stm32.c +2 -2
index 14ca7ea..cc4a731 100644
@@ -912,8 +912,8 @@ static irqreturn_t stm32h7_spi_irq_thread(int irq, void *dev_id)
 		if (!spi->cur_usedma && (spi->rx_buf && (spi->rx_len > 0)))
 			stm32h7_spi_read_rxfifo(spi);
 		if (!spi->cur_usedma ||
-		    (spi->cur_usedma && (spi->cur_comm == SPI_SIMPLEX_TX ||
-		     spi->cur_comm == SPI_3WIRE_TX)))
+			(spi->cur_comm == SPI_SIMPLEX_TX ||
+			spi->cur_comm == SPI_3WIRE_TX))
 			end = true;
 	}
 
Signature · 1 line
1.8.3.1
maintainer
#1 lore raw

Hi,

thanks for the patch. We've had this issue reported previously with a patch provided at
(https://lore.kernel.org/linux-spi/20210713191004.GA14729@5eb5c2cbef84/).
I've put my reviewed-by so it should make its way to the linux-next soon.

Regards,
Alain

Quoted 31 lines · CGEL

From: jing yangyang <[email protected]>

WARNING !A || A && B is equivalent to !A || B

This issue was detected with the help of Coccinelle.

---
 drivers/spi/spi-stm32.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/spi/spi-stm32.c +2 -2
index 14ca7ea..cc4a731 100644
@@ -912,8 +912,8 @@ static irqreturn_t stm32h7_spi_irq_thread(int irq, void *dev_id)
 		if (!spi->cur_usedma && (spi->rx_buf && (spi->rx_len > 0)))
 			stm32h7_spi_read_rxfifo(spi);
 		if (!spi->cur_usedma ||
-		    (spi->cur_usedma && (spi->cur_comm == SPI_SIMPLEX_TX ||
-		     spi->cur_comm == SPI_3WIRE_TX)))
+			(spi->cur_comm == SPI_SIMPLEX_TX ||
+			spi->cur_comm == SPI_3WIRE_TX))
 			end = true;
 	}
 
Signature · 1 line
1.8.3.1