net/core/sock: fix coding style issues Fix multiple coding style issues in net/core/sock.c:
Subsystems (3)
PATCH 1/1 net/core/sock: fix coding style issues Fix multiple coding style issues in net/core/sock.c:
- Remove spaces before commas in _sock_locks macro definition
- Use tabs instead of spaces for macro line continuation indentation
- Separate assignment from if condition in __sk_receive_skb function
- Fix pointer declaration format in timer functions
- Add spaces around == operator in preprocessor directive
These changes improve code style compliance with kernel coding standards without affecting functionality.
--- net/core/sock.c | 59 ++++++++++++++++++++++++++----------------------- 1 file changed, 31 insertions(+), 28 deletions(-)
net/core/sock.c +31 -28
@@ -223,23 +223,23 @@ static struct lock_class_key af_family_kern_slock_keys[AF_MAX];*/ #define _sock_locks (x) \ - x "AF_UNSPEC", x "AF_UNIX" , x "AF_INET" , \ - x "AF_AX25" , x "AF_IPX" , x "AF_APPLETALK", \ - x "AF_NETROM", x "AF_BRIDGE" , x "AF_ATMPVC" , \ - x "AF_X25" , x "AF_INET6" , x "AF_ROSE" , \ - x "AF_DECnet", x "AF_NETBEUI" , x "AF_SECURITY" , \ - x "AF_KEY" , x "AF_NETLINK" , x "AF_PACKET" , \ - x "AF_ASH" , x "AF_ECONET" , x "AF_ATMSVC" , \ - x "AF_RDS" , x "AF_SNA" , x "AF_IRDA" , \ - x "AF_PPPOX" , x "AF_WANPIPE" , x "AF_LLC" , \ - x "27" , x "28" , x "AF_CAN" , \ - x "AF_TIPC" , x "AF_BLUETOOTH", x "IUCV" , \ - x "AF_RXRPC" , x "AF_ISDN" , x "AF_PHONET" , \ - x "AF_IEEE802154", x "AF_CAIF" , x "AF_ALG" , \ - x "AF_NFC" , x "AF_VSOCK" , x "AF_KCM" , \ - x "AF_QIPCRTR", x "AF_SMC" , x "AF_XDP" , \ - x "AF_MCTP" , \ - x "AF_MAX" + x "AF_UNSPEC", x "AF_UNIX", x "AF_INET", \ + x "AF_AX25", x "AF_IPX", x "AF_APPLETALK", \ + x "AF_NETROM", x "AF_BRIDGE", x "AF_ATMPVC", \ + x "AF_X25", x "AF_INET6", x "AF_ROSE", \ + x "AF_DECnet", x "AF_NETBEUI", x "AF_SECURITY", \ + x "AF_KEY", x "AF_NETLINK", x "AF_PACKET", \ + x "AF_ASH", x "AF_ECONET", x "AF_ATMSVC", \ + x "AF_RDS", x "AF_SNA", x "AF_IRDA", \ + x "AF_PPPOX", x "AF_WANPIPE", x "AF_LLC", \ + x "27", x "28", x "AF_CAN", \ + x "AF_TIPC", x "AF_BLUETOOTH", x "IUCV", \ + x "AF_RXRPC", x "AF_ISDN", x "AF_PHONET", \ + x "AF_IEEE802154", x "AF_CAIF", x "AF_ALG", \ + x "AF_NFC", x "AF_VSOCK", x "AF_KCM", \ + x "AF_QIPCRTR", x "AF_SMC", x "AF_XDP", \ + x "AF_MCTP", \ + x "AF_MAX"static const char *const af_family_key_strings[AF_MAX +1 ] = {_sock_locks ("sk_lock-" )
@@ -579,14 +579,17 @@ int __sk_receive_skb(struct sock *sk, struct sk_buff *skb, rc =sk_backlog_rcv (sk, skb);mutex_release (&sk->sk_lock.dep_map, _RET_IP_); - }else if ((err =sk_add_backlog (sk, skb,READ_ONCE (sk->sk_rcvbuf)))) { -bh_unlock_sock (sk); -if (err == -ENOMEM ) - reason =SKB_DROP_REASON_PFMEMALLOC ; -if (err == -ENOBUFS ) - reason =SKB_DROP_REASON_SOCKET_BACKLOG ; -sk_drops_inc (sk); - goto discard_and_relse; + }else { + err =sk_add_backlog (sk, skb,READ_ONCE (sk->sk_rcvbuf)); +if (err) { +bh_unlock_sock (sk); +if (err == -ENOMEM ) + reason =SKB_DROP_REASON_PFMEMALLOC ; +if (err == -ENOBUFS ) + reason =SKB_DROP_REASON_SOCKET_BACKLOG ; +sk_drops_inc (sk); + goto discard_and_relse; + } }bh_unlock_sock (sk);
@@ -3611,7 +3614,7 @@ void sk_send_sigurg(struct sock *sk) }EXPORT_SYMBOL (sk_send_sigurg); -void sk_reset_timer (struct sock *sk,struct timer_list * timer, +void sk_reset_timer (struct sock *sk,struct timer_list *timer,unsigned long expires) {if (!mod_timer (timer, expires))
@@ -3619,7 +3622,7 @@ void sk_reset_timer(struct sock *sk, struct timer_list* timer, }EXPORT_SYMBOL (sk_reset_timer); -void sk_stop_timer (struct sock *sk,struct timer_list * timer) +void sk_stop_timer (struct sock *sk,struct timer_list *timer) {if (timer_delete (timer))__sock_put (sk);
@@ -3678,7 +3681,7 @@ void sock_init_data_uid(struct socket *sock, struct sock *sk, kuid_t uid) sk->sk_sndtimeo =MAX_SCHEDULE_TIMEOUT ; sk->sk_stamp =SK_DEFAULT_STAMP ; -#if BITS_PER_LONG ==32 +#if BITS_PER_LONG ==32 seqlock_init (&sk->sk_stamp_seq);#endif atomic_set (&sk->sk_zckey,0 );
Signature · 1 line
2.17.1
Jakub Kicinski
maintainerQuoted 8 lines · On Mon, 3 Nov 2025 10:36:53 +0800 XueBing Chen wrote:
- Remove spaces before commas in
_sock_locksmacro definition
- Use tabs instead of spaces for macro line continuation indentation
- Separate assignment from if condition in__sk_receive_skbfunction
- Fix pointer declaration format in timer functions
- Add spaces around == operator in preprocessor directiveThese changes improve code style compliance with kernel coding standards without affecting functionality.
Quoting documentation:
Clean-up patches
~~~~~~~~~~~~~~~~
Netdev discourages patches which perform simple clean-ups, which are not in the context of other work. For example:
* Addressing ``checkpatch.pl``, and other trivial coding style warnings
* Addressing :ref:Local variable ordering<rcs> issues
* Conversions to device-managed APIs (``devm_`` helpers)
This is because it is felt that the churn that such changes produce comes at a greater cost than the value of such clean-ups.
Conversely, spelling and grammar fixes are not discouraged.
See: https://www.kernel.org/doc/html/next/process/maintainer-netdev.html#clean-up-patches
Signature · 1 line
pw-bot: reject