[PATCH v6 05/13] spi: spidev_test: abort when -I is selected without -S

From: Jonas Rebmann

Date: Thu Sep 24 2026 - 08:29:39 EST


-I (--iter) for transferring multiple iterations of the selected input
currently only has an effect when transferring random data using -S
(--size). Error out if -I is used without -S to avoid confusion.

Signed-off-by: Jonas Rebmann <jre@xxxxxxxxxxxxxx>
---
tools/spi/spidev_test.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/tools/spi/spidev_test.c b/tools/spi/spidev_test.c
index 908ed038889b..97d09bf4dafb 100644
--- a/tools/spi/spidev_test.c
+++ b/tools/spi/spidev_test.c
@@ -463,6 +463,9 @@ int main(int argc, char *argv[])
if (random_input && transfer_size < 0)
pabort("a size argument is mandatory for -S (--size)");

+ if (iterations && transfer_size < 0)
+ pabort("-I (--iter) is only implemented for -S (--size)");
+
fd = open(device, O_RDWR);
if (fd < 0)
pabort("can't open device");

--
2.56.0.rc0.108.gf0ef1b96a0