mirror of
https://github.com/torvalds/linux.git
synced 2026-11-20 13:03:48 +00:00
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 <[email protected]>
Link: https://lore.kernel.org/r/20260908-samples-rpmsg-fix-mtu-print-v1-1-f995518f0a46@kernel.org
Signed-off-by: Mathieu Poirier <[email protected]>
This commit is contained in:
committed by
Mathieu Poirier
parent
1029c89baf
commit
c39c2cdbde
@@ -65,18 +65,18 @@ static int rpmsg_sample_probe(struct rpmsg_device *rpdev)
|
||||
|
||||
mtu = rpmsg_get_mtu(rpdev->ept);
|
||||
if (mtu < 0) {
|
||||
dev_warn(&rpdev->dev, "invalid rpmsg MTU size = %ld\n", mtu);
|
||||
dev_warn(&rpdev->dev, "invalid rpmsg MTU size = %zd\n", mtu);
|
||||
return mtu;
|
||||
}
|
||||
|
||||
dev_info(&rpdev->dev, "rpmsg MTU size = %ld\n", mtu);
|
||||
dev_info(&rpdev->dev, "rpmsg MTU size = %zd\n", mtu);
|
||||
|
||||
msg_len = strlen(MSG);
|
||||
/* make sure our message fits in a single rpmsg buffer */
|
||||
if (msg_len > mtu) {
|
||||
dev_err(&rpdev->dev,
|
||||
"message size %zu exceeds rpmsg MTU size %ld\n",
|
||||
strlen(MSG), mtu);
|
||||
"message size %zd exceeds rpmsg MTU size %zd\n",
|
||||
msg_len, mtu);
|
||||
return -EMSGSIZE;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user