fd_install(pidfd, pidfd_file);
 }
 
-static __inline__ void scm_recv(struct socket *sock, struct msghdr *msg,
-                               struct scm_cookie *scm, int flags)
+static inline bool __scm_recv_common(struct socket *sock, struct msghdr *msg,
+                                    struct scm_cookie *scm, int flags)
 {
        if (!msg->msg_control) {
                if (test_bit(SOCK_PASSCRED, &sock->flags) ||
                    scm->fp || scm_has_secdata(sock))
                        msg->msg_flags |= MSG_CTRUNC;
                scm_destroy(scm);
-               return;
+               return false;
        }
 
        if (test_bit(SOCK_PASSCRED, &sock->flags)) {
                put_cmsg(msg, SOL_SOCKET, SCM_CREDENTIALS, sizeof(ucreds), &ucreds);
        }
 
-       if (test_bit(SOCK_PASSPIDFD, &sock->flags))
-               scm_pidfd_recv(msg, scm);
+       scm_passec(sock, msg, scm);
 
-       scm_destroy_cred(scm);
+       if (scm->fp)
+               scm_detach_fds(msg, scm);
 
-       scm_passec(sock, msg, scm);
+       return true;
+}
 
-       if (!scm->fp)
+static inline void scm_recv(struct socket *sock, struct msghdr *msg,
+                           struct scm_cookie *scm, int flags)
+{
+       if (!__scm_recv_common(sock, msg, scm, flags))
                return;
-       
-       scm_detach_fds(msg, scm);
+
+       scm_destroy_cred(scm);
 }
 
+static inline void scm_recv_unix(struct socket *sock, struct msghdr *msg,
+                                struct scm_cookie *scm, int flags)
+{
+       if (!__scm_recv_common(sock, msg, scm, flags))
+               return;
+
+       if (test_bit(SOCK_PASSPIDFD, &sock->flags))
+               scm_pidfd_recv(msg, scm);
+
+       scm_destroy_cred(scm);
+}
 
 #endif /* __LINUX_NET_SCM_H */
 
 
        }
        err = (flags & MSG_TRUNC) ? skb->len - skip : size;
 
-       scm_recv(sock, msg, &scm, flags);
+       scm_recv_unix(sock, msg, &scm, flags);
 
 out_free:
        skb_free_datagram(sk, skb);
 
        mutex_unlock(&u->iolock);
        if (state->msg)
-               scm_recv(sock, state->msg, &scm, flags);
+               scm_recv_unix(sock, state->msg, &scm, flags);
        else
                scm_destroy(&scm);
 out: