The else-if arm taken for RX-only and full-duplex transfers and the
trailing else arm in the RX bookkeeping setup of ax_transfer_one()
have identical bodies, so the second condition has no effect:
drivers/spi/spi-axiado.c:433:8-10: WARNING: possible condition with
no effect (if == else)
The trailing else arm (neither TX nor RX buffer) is also unreachable:
the SPI core only calls the ->transfer_one() callback for transfers
that carry at least one buffer, see spi_transfer_one_message().
Merge the two arms into a single else branch and fold their comments.
No functional change. The redundant condition has been present since
the driver was added in commit e75a6b00ad79 ("spi: axiado: Add driver
for Axiado SPI DB controller").
Reported-by: kernel test robot <redacted>
Reported-by: Julia Lawall <julia.lawall@inria.fr>
Closes: https://lore.kernel.org/r/202607121827.djB0zLAj-lkp@intel.com/ (local)
Assisted-by: Claude:claude-fable-5 [coccinelle]
Signed-off-by: Babanpreet Singh <redacted>
---
drivers/spi/spi-axiado.c | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)
diff --git a/drivers/spi/spi-axiado.c b/drivers/spi/spi-axiado.c
index 649f149617ce..c4bc7a50d6c9 100644
--- a/drivers/spi/spi-axiado.c
+++ b/drivers/spi/spi-axiado.c
@@ -430,15 +430,11 @@ static int ax_transfer_one(struct spi_controller *ctlr,
/* TX mode: discard all received data */
xspi->rx_discard = transfer->len;
xspi->rx_copy_remaining = 0;
- } else if ((!transfer->tx_buf && transfer->rx_buf) ||
- (transfer->tx_buf && transfer->rx_buf)) {
- /* RX mode: generate clock by filling TX FIFO with dummy bytes
- * Full-duplex mode: generate clock by filling TX FIFO
- */
- xspi->rx_discard = 0;
- xspi->rx_copy_remaining = transfer->len;
} else {
- /* No TX and RX */
+ /* RX-only or full-duplex mode: copy received data, with the
+ * clock generated by filling the TX FIFO (with dummy bytes
+ * in RX-only mode)
+ */
xspi->rx_discard = 0;
xspi->rx_copy_remaining = transfer->len;
}
base-commit: 5f1b513690edf51727e6928b97705b6437f9a98e
--
2.43.0