Skip to contentSkip to conversation

net/unix: Stylistic changes in diag.c

PATCH In review William Mokhlef [email protected] 2 participants 2 messages Nov 10, 2024 – Nov 11, 2024

Subsystems (3)
lore
Share & tools
lore

William Mokhlef [email protected]

author
#0 lore raw

PATCH 1/1 net/unix: Stylistic changes in diag.c

From: William Mokhlef <[email protected]>

Changes based on the script scripts/checkpatch.pl

Remove space after cast, blank line after declaration, fixed brace style

---
 net/unix/diag.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
net/unix/diag.c +6 -4
index 9138af8b465e..94d4d273f7f4 100644
@@ -94,8 +94,8 @@ static int sk_diag_show_rqlen(struct sock *sk, struct sk_buff *nlskb)
 		rql.udiag_rqueue = skb_queue_len_lockless(&sk->sk_receive_queue);
 		rql.udiag_wqueue = sk->sk_max_ack_backlog;
 	} else {
-		rql.udiag_rqueue = (u32) unix_inq_len(sk);
-		rql.udiag_wqueue = (u32) unix_outq_len(sk);
+		rql.udiag_rqueue = (u32)unix_inq_len(sk);
+		rql.udiag_wqueue = (u32)unix_outq_len(sk);
 	}
 
 	return nla_put(nlskb, UNIX_DIAG_RQLEN, sizeof(rql), &rql);
@@ -105,6 +105,7 @@ static int sk_diag_dump_uid(struct sock *sk, struct sk_buff *nlskb,
 			    struct user_namespace *user_ns)
 {
 	uid_t uid = from_kuid_munged(user_ns, sock_i_uid(sk));
+
 	return nla_put(nlskb, UNIX_DIAG_UID, sizeof(uid_t), &uid);
 }
 
@@ -250,7 +251,7 @@ static int unix_diag_get_exact(struct sk_buff *in_skb,
 
 	sk = unix_lookup_by_ino(net, req->udiag_ino);
 	err = -ENOENT;
-	if (sk == NULL)
+	if (!sk)
 		goto out_nosk;
 
 	err = sock_diag_check_cookie(sk, req->udiag_cookie);
@@ -296,8 +297,9 @@ static int unix_diag_handler_dump(struct sk_buff *skb, struct nlmsghdr *h)
 			.dump = unix_diag_dump,
 		};
 		return netlink_dump_start(sock_net(skb->sk)->diag_nlsk, skb, h, &c);
-	} else
+	} else {
 		return unix_diag_get_exact(skb, h, nlmsg_data(h));
+	}
 }
 
 static const struct sock_diag_handler unix_diag_handler = {
Signature · 1 line
2.42.0
maintainer
#1 lore raw
Quoted 6 lines · On Sun, 10 Nov 2024 01:59:20 +0100 [email protected]…

From: William Mokhlef <[email protected]>

Changes based on the script scripts/checkpatch.pl

Remove space after cast, blank line after declaration, fixed brace style

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`` 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: cr