From: Ninad Naik <ninadnaik07@gmail.com>
To: Mark Brown <broonie@kernel.org>,
Matthias Brugger <matthias.bgg@gmail.com>,
AngeloGioacchino Del Regno
<angelogioacchino.delregno@collabora.com>
Cc: linux-spi@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org,
Ninad Naik <ninadnaik07@gmail.com>
Subject: [PATCH v2] spi: mtk-snfi: use min() in mtk_snand_read_page_cache()
Date: Mon, 26 Oct 2026 16:50:33 +0530 [thread overview]
Message-ID: <20261026112033.36310-1-ninadnaik07@gmail.com> (raw)
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>
---
Changes in v2:
- Join the memcpy() arguments onto one line as min() is shorter.
drivers/spi/spi-mtk-snfi.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/spi/spi-mtk-snfi.c b/drivers/spi/spi-mtk-snfi.c
index 6e96e50fedad..7eb7b40db11d 100644
--- a/drivers/spi/spi-mtk-snfi.c
+++ b/drivers/spi/spi-mtk-snfi.c
@@ -1016,8 +1016,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);
+ buf_fdm, min(cap_len, req_left));
} else if (rd_offset < snf->buf_len) {
u32 cap_len = snf->buf_len - rd_offset;
--
2.56.0
reply other threads:[~2026-10-26 11:21 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20261026112033.36310-1-ninadnaik07@gmail.com \
--to=ninadnaik07@gmail.com \
--cc=angelogioacchino.delregno@collabora.com \
--cc=broonie@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux-spi@vger.kernel.org \
--cc=matthias.bgg@gmail.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 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®