OSDN Git Service

netlink: simplify nl_set_extack_cookie_u64(), nl_set_extack_cookie_u32()
authorAlexey Dobriyan <adobriyan@gmail.com>
Sat, 17 Apr 2021 11:38:07 +0000 (14:38 +0300)
committerDavid S. Miller <davem@davemloft.net>
Mon, 19 Apr 2021 22:41:28 +0000 (15:41 -0700)
Taking address of a function argument directly works just fine.

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/linux/netlink.h

index 0bcf980..61b1c7f 100644 (file)
@@ -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);