Skip to content

Commit

Permalink
tipc: eliminate duplicated discard_rx_queue routine
Browse files Browse the repository at this point in the history
The tipc function discard_rx_queue() is just a duplicated
implementation of __skb_queue_purge().  Remove the former
and directly invoke __skb_queue_purge().

In doing so, the underscores convey to the code reader, more
information about the current locking state that is assumed.

Signed-off-by: Ying Xue <ying.xue@windriver.com>
Signed-off-by: Jon Maloy <jon.maloy@ericsson.com>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
  • Loading branch information
Ying Xue authored and Paul Gortmaker committed Feb 15, 2013
1 parent d887199 commit 57467e5
Showing 1 changed file with 2 additions and 15 deletions.
17 changes: 2 additions & 15 deletions net/tipc/socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -128,19 +128,6 @@ static void advance_rx_queue(struct sock *sk)
kfree_skb(__skb_dequeue(&sk->sk_receive_queue));
}

/**
* discard_rx_queue - discard all buffers in socket receive queue
*
* Caller must hold socket lock
*/
static void discard_rx_queue(struct sock *sk)
{
struct sk_buff *buf;

while ((buf = __skb_dequeue(&sk->sk_receive_queue)))
kfree_skb(buf);
}

/**
* reject_rx_queue - reject all buffers in socket receive queue
*
Expand Down Expand Up @@ -292,7 +279,7 @@ static int release(struct socket *sock)
res = tipc_deleteport(tport->ref);

/* Discard any remaining (connection-based) messages in receive queue */
discard_rx_queue(sk);
__skb_queue_purge(&sk->sk_receive_queue);

/* Reject any messages that accumulated in backlog queue */
sock->state = SS_DISCONNECTING;
Expand Down Expand Up @@ -1637,7 +1624,7 @@ static int shutdown(struct socket *sock, int how)
case SS_DISCONNECTING:

/* Discard any unreceived messages */
discard_rx_queue(sk);
__skb_queue_purge(&sk->sk_receive_queue);

/* Wake up anyone sleeping in poll */
sk->sk_state_change(sk);
Expand Down

0 comments on commit 57467e5

Please sign in to comment.