linux/samples/rpmsg
Nathan Chancellor c39c2cdbde samples: rpmsg: Fix mtu printk specifiers
When building rpmsg_client_sample.c for a 32-bit platform, such as
during arm allmodconfig, there are a few warnings due to using an
incorrect specifier for mtu:

  samples/rpmsg/rpmsg_client_sample.c:68:59: error: format specifies type 'long' but the argument has type 'ssize_t' (aka 'int') [-Werror,-Wformat]
     68 |                 dev_warn(&rpdev->dev, "invalid rpmsg MTU size = %ld\n", mtu);
        |                                                                 ~~~     ^~~
        |                                                                 %zd
  ...
  samples/rpmsg/rpmsg_client_sample.c:72:50: error: format specifies type 'long' but the argument has type 'ssize_t' (aka 'int') [-Werror,-Wformat]
     72 |         dev_info(&rpdev->dev, "rpmsg MTU size = %ld\n", mtu);
        |                                                 ~~~     ^~~
        |                                                 %zd
  ...
  samples/rpmsg/rpmsg_client_sample.c:79:17: error: format specifies type 'long' but the argument has type 'ssize_t' (aka 'int') [-Werror,-Wformat]
     78 |                         "message size %zu exceeds rpmsg MTU size %ld\n",
        |                                                                  ~~~
        |                                                                  %zd
     79 |                         strlen(MSG), mtu);
        |                                      ^~~

Use '%zd', the proper specifier for a 'ssize_t' variable, to clear up
the warning. Additionally, modify the last dev_err() call in
rpmsg_sample_probe() to reuse msg_len instead of calling strlen(MSG)
again and use '%zd' throughout the string consistently.

Fixes: 1029c89baf ("samples: rpmsg: Add MTU size info")
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Link: https://lore.kernel.org/r/20260908-samples-rpmsg-fix-mtu-print-v1-1-f995518f0a46@kernel.org
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
2026-09-09 09:28:17 -06:00
..
Makefile
rpmsg_client_sample.c