Skip to contentSkip to conversation

spi: mtk-snfi: use min() in mtk_snand_read_page_cache()

PATCH In review Ninad Naik 2 participants 2 messages Oct 26 – Nov 2

Subsystems (2)
lore
Share & tools
lore

Ninad Naik

author
#0 lore raw

PATCH v2 1/1 spi: mtk-snfi: use min() in mtk_snand_read_page_cache()

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.

---
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(-)
drivers/spi/spi-mtk-snfi.c +1 -2
index 6e96e50fedad..7eb7b40db11d 100644
@@ -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;
 
Signature · 1 line
2.56.0
maintainer
#1 lore raw
Quoted 1 line · Ninad Naik

spi: mtk-snfi: use min() in mtk_snand_read_page_cache()

Applied to

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-7.5

Thanks!

[1/1] spi: mtk-snfi: use min() in mtk_snand_read_page_cache()

      https://git.kernel.org/broonie/spi/c/44e7659f4618

All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying to this mail.

Thanks,
Mark