Message ID | d250255b-fd88-4ea9-aa08-bc8d911143af@web.de (mailing list archive) |
---|---|
State | Changes Requested |
Headers | show |
Series | netlink: Adjustments for __netlink_kernel_create() | expand |
On Sun, 31 Dec 2023 18:48:11 +0100 Markus Elfring <Markus.Elfring@web.de> wrote: > From: Markus Elfring <elfring@users.sourceforge.net> > Date: Sun, 31 Dec 2023 18:16:26 +0100 > > Move one assignment for the variable “cb_mutex” closer to the place > where this pointer is used. > > Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> NAK Useless code churn, no improvement in performance or readablilty. Compiler optimizer will do this already if it wants.
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c index cfddc9c6a376..12a0b6f8be19 100644 --- a/net/netlink/af_netlink.c +++ b/net/netlink/af_netlink.c @@ -2019,7 +2019,7 @@ __netlink_kernel_create(struct net *net, int unit, struct module *module, struct sock *sk; struct netlink_sock *nlk; struct listeners *listeners; - struct mutex *cb_mutex = cfg ? cfg->cb_mutex : NULL; + struct mutex *cb_mutex; /* Serialize data processing with callbacks */ unsigned int groups; BUG_ON(!nl_table); @@ -2030,6 +2030,7 @@ __netlink_kernel_create(struct net *net, int unit, struct module *module, if (sock_create_lite(PF_NETLINK, SOCK_DGRAM, unit, &sock)) return NULL; + cb_mutex = (cfg ? cfg->cb_mutex : NULL); if (__netlink_create(net, sock, cb_mutex, unit, 1) < 0) goto out_sock_release_nosk;