[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240827165723.GQ1368797@kernel.org>
Date: Tue, 27 Aug 2024 17:57:23 +0100
From: Simon Horman <horms@...nel.org>
To: Hongbo Li <lihongbo22@...wei.com>
Cc: davem@...emloft.net, dsahern@...nel.org, edumazet@...gle.com,
kuba@...nel.org, pabeni@...hat.com, jmaloy@...hat.com,
ying.xue@...driver.com, pablo@...filter.org, kadlec@...filter.org,
netdev@...r.kernel.org, netfilter-devel@...r.kernel.org
Subject: Re: [PATCH net-next 2/5] net/tipc: make use of the helper macro
LIST_HEAD()
On Tue, Aug 27, 2024 at 06:04:04PM +0800, Hongbo Li wrote:
> list_head can be initialized automatically with LIST_HEAD()
> instead of calling INIT_LIST_HEAD(). Here we can simplify
> the code.
>
> Signed-off-by: Hongbo Li <lihongbo22@...wei.com>
> ---
> net/tipc/socket.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/net/tipc/socket.c b/net/tipc/socket.c
> index 1a0cd06f0eae..9d30e362392c 100644
> --- a/net/tipc/socket.c
> +++ b/net/tipc/socket.c
> @@ -1009,12 +1009,11 @@ static int tipc_send_group_anycast(struct socket *sock, struct msghdr *m,
> struct tipc_member *mbr = NULL;
> struct net *net = sock_net(sk);
> u32 node, port, exclude;
> - struct list_head dsts;
> int lookups = 0;
> int dstcnt, rc;
> bool cong;
> + LIST_HEAD(dsts);
nit: Please place this new line where the old dsts line was,
in order to preserve, within the context of this hunk,
reverse xmas tree order - longest line to shortest -
for local variable declarations.
>
> - INIT_LIST_HEAD(&dsts);
> ua->sa.type = msg_nametype(hdr);
> ua->scope = msg_lookup_scope(hdr);
>
> @@ -1161,10 +1160,9 @@ static int tipc_send_group_mcast(struct socket *sock, struct msghdr *m,
> struct tipc_group *grp = tsk->group;
> struct tipc_msg *hdr = &tsk->phdr;
> struct net *net = sock_net(sk);
> - struct list_head dsts;
> u32 dstcnt, exclude;
> + LIST_HEAD(dsts);
>
> - INIT_LIST_HEAD(&dsts);
> ua->sa.type = msg_nametype(hdr);
> ua->scope = msg_lookup_scope(hdr);
> exclude = tipc_group_exclude(grp);
--
pw-bot: cr
Powered by blists - more mailing lists