]> git.proxmox.com Git - mirror_ubuntu-disco-kernel.git/commitdiff
tipc: Standardize exit logic for message rejection handling
authorAllan Stephens <allan.stephens@windriver.com>
Mon, 23 May 2011 17:47:44 +0000 (13:47 -0400)
committerPaul Gortmaker <paul.gortmaker@windriver.com>
Fri, 24 Jun 2011 20:18:15 +0000 (16:18 -0400)
Modifies the routine that handles the rejection of payload messages
so that it has a single exit point that frees up the rejected message,
thereby eliminating some duplicated code.

Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
net/tipc/port.c

index c68dc956a4234e5759b53d5e3e460e61d882b171..3946b5b10c7478b9ee100af14c825fc45c2e4e6f 100644 (file)
@@ -367,10 +367,8 @@ int tipc_reject_msg(struct sk_buff *buf, u32 err)
                imp++;
 
        /* discard rejected message if it shouldn't be returned to sender */
-       if (msg_errcode(msg) || msg_dest_droppable(msg)) {
-               buf_discard(buf);
-               return data_sz;
-       }
+       if (msg_errcode(msg) || msg_dest_droppable(msg))
+               goto exit;
 
        /* construct rejected message */
        if (msg_mcast(msg))
@@ -378,10 +376,9 @@ int tipc_reject_msg(struct sk_buff *buf, u32 err)
        else
                hdr_sz = LONG_H_SIZE;
        rbuf = tipc_buf_acquire(data_sz + hdr_sz);
-       if (rbuf == NULL) {
-               buf_discard(buf);
-               return data_sz;
-       }
+       if (rbuf == NULL)
+               goto exit;
+
        rmsg = buf_msg(rbuf);
        tipc_msg_init(rmsg, imp, msg_type(msg), hdr_sz, msg_orignode(msg));
        msg_set_errcode(rmsg, err);
@@ -411,9 +408,11 @@ int tipc_reject_msg(struct sk_buff *buf, u32 err)
                tipc_net_route_msg(abuf);
        }
 
-       /* send rejected message */
-       buf_discard(buf);
+       /* send returned message & dispose of rejected message */
+
        tipc_net_route_msg(rbuf);
+exit:
+       buf_discard(buf);
        return data_sz;
 }