diff options
author | Dmitry Antipov <dmantipov@yandex.ru> | 2025-09-26 10:41:13 +0300 |
---|---|---|
committer | Paolo Abeni <pabeni@redhat.com> | 2025-09-30 11:22:39 +0200 |
commit | 2ade91705b596b7b6b7de84c0ca59eced7acd1f6 (patch) | |
tree | 05c1a7aecc7a74910087ef09b9a30fa2258d8acd /net/tipc/addr.c | |
parent | 38b04ed7072e54086102eae2d05d03ffcdb4b695 (diff) |
tipc: adjust tipc_nodeid2string() to return string length
Since the value returned by 'tipc_nodeid2string()' is not used, the
function may be adjusted to return the length of the result, which
is helpful to drop a few calls to 'strlen()' in 'tipc_link_create()'
and 'tipc_link_bc_create()'. Compile tested only.
Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20250926074113.914399-1-dmantipov@yandex.ru
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Diffstat (limited to 'net/tipc/addr.c')
-rw-r--r-- | net/tipc/addr.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/net/tipc/addr.c b/net/tipc/addr.c index fd0796269eed..6f5c54cbf8d9 100644 --- a/net/tipc/addr.c +++ b/net/tipc/addr.c @@ -79,7 +79,7 @@ void tipc_set_node_addr(struct net *net, u32 addr) pr_info("Node number set to %u\n", addr); } -char *tipc_nodeid2string(char *str, u8 *id) +int tipc_nodeid2string(char *str, u8 *id) { int i; u8 c; @@ -109,7 +109,7 @@ char *tipc_nodeid2string(char *str, u8 *id) if (i == NODE_ID_LEN) { memcpy(str, id, NODE_ID_LEN); str[NODE_ID_LEN] = 0; - return str; + return i; } /* Translate to hex string */ @@ -120,5 +120,5 @@ char *tipc_nodeid2string(char *str, u8 *id) for (i = NODE_ID_STR_LEN - 2; str[i] == '0'; i--) str[i] = 0; - return str; + return i + 1; } |