mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] spi: mtk-snfi: use min() in mtk_snand_read_page_cache()
@ 2026-10-22 10:20 Ninad Naik
  2026-10-22 11:51 ` David Laight
  0 siblings, 1 reply; 2+ messages in thread
From: Ninad Naik @ 2026-10-22 10:20 UTC (permalink / raw)
  To: Mark Brown, Matthias Brugger, AngeloGioacchino Del Regno
  Cc: linux-spi, linux-arm-kernel, linux-mediatek, linux-kernel, Ninad Naik

Replace the ternary case with min() to pick the smaller of cap_len and
req_left.
No functional change intended. Compile tested only.
Found using Coccinelle.

Signed-off-by: Ninad Naik <ninadnaik07@gmail.com>
---
 drivers/spi/spi-mtk-snfi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/spi/spi-mtk-snfi.c b/drivers/spi/spi-mtk-snfi.c
index 6e96e50fedad..bbb65a21a684 100644
--- a/drivers/spi/spi-mtk-snfi.c
+++ b/drivers/spi/spi-mtk-snfi.c
@@ -1017,7 +1017,7 @@ static int mtk_snand_read_page_cache(struct mtk_snand *snf,
 			if (req_left)
 				memcpy(op->data.buf.in + snf->nfi_cfg.page_size,
 				       buf_fdm,
-				       cap_len < req_left ? cap_len : req_left);
+				       min(cap_len, req_left));
 		} else if (rd_offset < snf->buf_len) {
 			u32 cap_len = snf->buf_len - rd_offset;
 
-- 
2.56.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-10-22 11:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-22 10:20 [PATCH] spi: mtk-snfi: use min() in mtk_snand_read_page_cache() Ninad Naik
2026-10-22 11:51 ` David Laight

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®