]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
selftests: iou-zcrx: Clean up build warnings for error format
authorHaiyue Wang <haiyuewa@163.com>
Fri, 2 May 2025 17:50:25 +0000 (01:50 +0800)
committerJakub Kicinski <kuba@kernel.org>
Mon, 5 May 2025 23:55:15 +0000 (16:55 -0700)
Clean up two build warnings:

[1]

iou-zcrx.c: In function ‘process_recvzc’:
iou-zcrx.c:263:37: warning: too many arguments for format [-Wformat-extra-args]
  263 |                         error(1, 0, "payload mismatch at ", i);
      |                                     ^~~~~~~~~~~~~~~~~~~~~~

[2] Use "%zd" for ssize_t type as better

iou-zcrx.c: In function ‘run_client’:
iou-zcrx.c:357:47: warning: format ‘%d’ expects argument of type ‘int’, but argument 4 has type ‘ssize_t’ {aka ‘long int’} [-Wformat=]
  357 |                         error(1, 0, "send(): %d", sent);
      |                                              ~^   ~~~~
      |                                               |   |
      |                                               int ssize_t {aka long int}
      |                                              %ld

Signed-off-by: Haiyue Wang <haiyuewa@163.com>
Reviewed-by: David Wei <dw@davidwei.uk>
Link: https://patch.msgid.link/20250502175136.1122-1-haiyuewa@163.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
tools/testing/selftests/drivers/net/hw/iou-zcrx.c

index 8aa426014c87b3cbd3a2238bd8814f596f70f6c7..62456df947bc56119e9b67c8cec02c8c4dd7559a 100644 (file)
@@ -260,7 +260,7 @@ static void process_recvzc(struct io_uring *ring, struct io_uring_cqe *cqe)
 
        for (i = 0; i < n; i++) {
                if (*(data + i) != payload[(received + i)])
-                       error(1, 0, "payload mismatch at ", i);
+                       error(1, 0, "payload mismatch at %d", i);
        }
        received += n;
 
@@ -354,7 +354,7 @@ static void run_client(void)
                chunk = min_t(ssize_t, cfg_payload_len, to_send);
                res = send(fd, src, chunk, 0);
                if (res < 0)
-                       error(1, 0, "send(): %d", sent);
+                       error(1, 0, "send(): %zd", sent);
                sent += res;
                to_send -= res;
        }