Skip to contentSkip to conversation

netlink: simplify nl_set_extack_cookie_u64(), nl_set_extack_cookie_u32()

PATCH Applied Alexey Dobriyan 2 participants 2 messages Apr 17, 2021 – Apr 19, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 netlink: simplify nl_set_extack_cookie_u64(), nl_set_extack_cookie_u32()

Taking address of a function argument directly works just fine.

---

 include/linux/netlink.h |   12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)
include/linux/netlink.h +4 -8
@@ -129,23 +129,19 @@ struct netlink_ext_ack {
 static inline void nl_set_extack_cookie_u64(struct netlink_ext_ack *extack,
 					    u64 cookie)
 {
-	u64 __cookie = cookie;
-
 	if (!extack)
 		return;
-	memcpy(extack->cookie, &__cookie, sizeof(__cookie));
-	extack->cookie_len = sizeof(__cookie);
+	memcpy(extack->cookie, &cookie, sizeof(cookie));
+	extack->cookie_len = sizeof(cookie);
 }
 
 static inline void nl_set_extack_cookie_u32(struct netlink_ext_ack *extack,
 					    u32 cookie)
 {
-	u32 __cookie = cookie;
-
 	if (!extack)
 		return;
-	memcpy(extack->cookie, &__cookie, sizeof(__cookie));
-	extack->cookie_len = sizeof(__cookie);
+	memcpy(extack->cookie, &cookie, sizeof(cookie));
+	extack->cookie_len = sizeof(cookie);
 }
 
 void netlink_kernel_release(struct sock *sk);
#1 lore raw
This patch was applied to netdev/net-next.git (refs/heads/master):

Hello:

This patch was applied to netdev/net-next.git (refs/heads/master):

Quoted 7 lines · On Sat, 17 Apr 2021 14:38:07 +0300 you wrote:

Taking address of a function argument directly works just fine.

---

 include/linux/netlink.h |   12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

Here is the summary with links:
- [net-next] netlink: simplify nl_set_extack_cookie_u64(), nl_set_extack_cookie_u32()

    https://git.kernel.org/netdev/net-next/c/c6400e3fc3fa

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html