/* Create a link endpoint for this bearer, if necessary */
        if (!link) {
-               link = tipc_link_create(b_ptr, orig, &media_addr);
+               link = tipc_link_create(n_ptr, b_ptr, &media_addr);
                if (!link) {
                        tipc_node_unlock(n_ptr);
                        return;
 
 
 /**
  * tipc_link_create - create a new link
+ * @n_ptr: pointer to associated node
  * @b_ptr: pointer to associated bearer
- * @peer: network address of node at other end of link
  * @media_addr: media address to use when sending messages over link
  *
  * Returns pointer to link.
  */
 
-struct link *tipc_link_create(struct tipc_bearer *b_ptr, const u32 peer,
+struct link *tipc_link_create(struct tipc_node *n_ptr,
+                             struct tipc_bearer *b_ptr,
                              const struct tipc_media_addr *media_addr)
 {
        struct link *l_ptr;
        struct tipc_msg *msg;
        char *if_name;
+       char addr_string[16];
+       u32 peer = n_ptr->addr;
+
+       if (n_ptr->link_cnt >= 2) {
+               tipc_addr_string_fill(addr_string, n_ptr->addr);
+               err("Attempt to establish third link to %s\n", addr_string);
+               return NULL;
+       }
+
+       if (n_ptr->links[b_ptr->identity]) {
+               tipc_addr_string_fill(addr_string, n_ptr->addr);
+               err("Attempt to establish second link on <%s> to %s\n",
+                   b_ptr->name, addr_string);
+               return NULL;
+       }
 
        l_ptr = kzalloc(sizeof(*l_ptr), GFP_ATOMIC);
        if (!l_ptr) {
                tipc_zone(peer), tipc_cluster(peer), tipc_node(peer));
                /* note: peer i/f is appended to link name by reset/activate */
        memcpy(&l_ptr->media_addr, media_addr, sizeof(*media_addr));
+       l_ptr->owner = n_ptr;
        l_ptr->checkpoint = 1;
        l_ptr->b_ptr = b_ptr;
        link_set_supervision_props(l_ptr, b_ptr->media->tolerance);
 
        link_reset_statistics(l_ptr);
 
-       l_ptr->owner = tipc_node_attach_link(l_ptr);
-       if (!l_ptr->owner) {
-               kfree(l_ptr);
-               return NULL;
-       }
+       tipc_node_attach_link(n_ptr, l_ptr);
 
        k_init_timer(&l_ptr->timer, (Handler)link_timeout, (unsigned long)l_ptr);
        list_add_tail(&l_ptr->link_list, &b_ptr->links);
 
 
 struct tipc_port;
 
-struct link *tipc_link_create(struct tipc_bearer *b_ptr, const u32 peer,
+struct link *tipc_link_create(struct tipc_node *n_ptr,
+                             struct tipc_bearer *b_ptr,
                              const struct tipc_media_addr *media_addr);
 void tipc_link_delete(struct link *l_ptr);
 void tipc_link_changeover(struct link *l_ptr);
 
        return tipc_node_active_links(n_ptr);
 }
 
-struct tipc_node *tipc_node_attach_link(struct link *l_ptr)
+void tipc_node_attach_link(struct tipc_node *n_ptr, struct link *l_ptr)
 {
-       struct tipc_node *n_ptr = tipc_node_find(l_ptr->addr);
-
-       if (!n_ptr)
-               n_ptr = tipc_node_create(l_ptr->addr);
-       if (n_ptr) {
-               u32 bearer_id = l_ptr->b_ptr->identity;
-               char addr_string[16];
-
-               if (n_ptr->link_cnt >= 2) {
-                       err("Attempt to create third link to %s\n",
-                           tipc_addr_string_fill(addr_string, n_ptr->addr));
-                       return NULL;
-               }
-
-               if (!n_ptr->links[bearer_id]) {
-                       n_ptr->links[bearer_id] = l_ptr;
-                       atomic_inc(&tipc_num_links);
-                       n_ptr->link_cnt++;
-                       return n_ptr;
-               }
-               err("Attempt to establish second link on <%s> to %s\n",
-                   l_ptr->b_ptr->name,
-                   tipc_addr_string_fill(addr_string, l_ptr->addr));
-       }
-       return NULL;
+       n_ptr->links[l_ptr->b_ptr->identity] = l_ptr;
+       atomic_inc(&tipc_num_links);
+       n_ptr->link_cnt++;
 }
 
 void tipc_node_detach_link(struct tipc_node *n_ptr, struct link *l_ptr)
 
 struct tipc_node *tipc_node_find(u32 addr);
 struct tipc_node *tipc_node_create(u32 addr);
 void tipc_node_delete(struct tipc_node *n_ptr);
-struct tipc_node *tipc_node_attach_link(struct link *l_ptr);
+void tipc_node_attach_link(struct tipc_node *n_ptr, struct link *l_ptr);
 void tipc_node_detach_link(struct tipc_node *n_ptr, struct link *l_ptr);
 void tipc_node_link_down(struct tipc_node *n_ptr, struct link *l_ptr);
 void tipc_node_link_up(struct tipc_node *n_ptr, struct link *l_ptr);