From: Babanpreet Singh <bbnpreetsingh@gmail.com>
To: Mark Brown <broonie@kernel.org>
Cc: Vladimir Moravcevic <vmoravcevic@axiado.com>,
Tzu-Hao Wei <twei@axiado.com>, Swark Yang <syang@axiado.com>,
Prasad Bolisetty <pbolisetty@axiado.com>,
Karthikeyan Mitran <kmitran@axiado.com>,
kernel test robot <lkp@intel.com>,
Julia Lawall <julia.lawall@inria.fr>,
linux-spi@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org,
Babanpreet Singh <bbnpreetsingh@gmail.com>
Subject: [PATCH 1/2] spi: axiado: merge identical if/else branches in ax_transfer_one()
Date: Mon, 13 Jul 2026 06:08:06 +0000 [thread overview]
Message-ID: <20260713060807.7-2-bbnpreetsingh@gmail.com> (raw)
In-Reply-To: <20260713060807.7-1-bbnpreetsingh@gmail.com>
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 <lkp@intel.com>
Reported-by: Julia Lawall <julia.lawall@inria.fr>
Closes: https://lore.kernel.org/r/202607121827.djB0zLAj-lkp@intel.com/
Assisted-by: Claude:claude-fable-5 [coccinelle]
Signed-off-by: Babanpreet Singh <bbnpreetsingh@gmail.com>
---
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
next prev parent reply other threads:[~2026-07-13 6:08 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-13 6:08 [PATCH 0/2] spi: axiado: cond_no_effect and kernel-doc fixes Babanpreet Singh
2026-07-13 6:08 ` Babanpreet Singh [this message]
2026-07-13 6:08 ` [PATCH 2/2] spi: axiado: fix kernel-doc comments Babanpreet Singh
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260713060807.7-2-bbnpreetsingh@gmail.com \
--to=bbnpreetsingh@gmail.com \
--cc=broonie@kernel.org \
--cc=julia.lawall@inria.fr \
--cc=kmitran@axiado.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-spi@vger.kernel.org \
--cc=lkp@intel.com \
--cc=pbolisetty@axiado.com \
--cc=syang@axiado.com \
--cc=twei@axiado.com \
--cc=vmoravcevic@axiado.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.