[PATCH] spi: loopback-test: Do not split 1024-byte hexdumps

Geert Uytterhoeven posted 1 patch 9 months, 1 week ago
drivers/spi/spi-loopback-test.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] spi: loopback-test: Do not split 1024-byte hexdumps
Posted by Geert Uytterhoeven 9 months, 1 week ago
spi_test_print_hex_dump() prints buffers holding less than 1024 bytes in
full.  Larger buffers are truncated: only the first 512 and the last 512
bytes are printed, separated by a truncation message.  The latter is
confusing in case the buffer holds exactly 1024 bytes, as all data is
printed anyway.

Fix this by printing buffers holding up to and including 1024 bytes in
full.

Fixes: 84e0c4e5e2c4ef42 ("spi: add loopback test driver to allow for spi_master regression tests")
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 drivers/spi/spi-loopback-test.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/spi/spi-loopback-test.c b/drivers/spi/spi-loopback-test.c
index 31a878d9458d95fd..7740f94847a883f3 100644
--- a/drivers/spi/spi-loopback-test.c
+++ b/drivers/spi/spi-loopback-test.c
@@ -420,7 +420,7 @@ MODULE_LICENSE("GPL");
 static void spi_test_print_hex_dump(char *pre, const void *ptr, size_t len)
 {
 	/* limit the hex_dump */
-	if (len < 1024) {
+	if (len <= 1024) {
 		print_hex_dump(KERN_INFO, pre,
 			       DUMP_PREFIX_OFFSET, 16, 1,
 			       ptr, len, 0);
-- 
2.43.0
Re: [PATCH] spi: loopback-test: Do not split 1024-byte hexdumps
Posted by Mark Brown 9 months, 1 week ago
On Fri, 02 May 2025 13:10:35 +0200, Geert Uytterhoeven wrote:
> spi_test_print_hex_dump() prints buffers holding less than 1024 bytes in
> full.  Larger buffers are truncated: only the first 512 and the last 512
> bytes are printed, separated by a truncation message.  The latter is
> confusing in case the buffer holds exactly 1024 bytes, as all data is
> printed anyway.
> 
> Fix this by printing buffers holding up to and including 1024 bytes in
> full.
> 
> [...]

Applied to

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

Thanks!

[1/1] spi: loopback-test: Do not split 1024-byte hexdumps
      commit: a73fa3690a1f3014d6677e368dce4e70767a6ba2

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