Skip to content

Commit

Permalink
sctp: remove an unnecessary check from sctp_endpoint_destroy
Browse files Browse the repository at this point in the history
ep->base.sk gets it's value since sctp_endpoint_new, nowhere
will change it. So there's no need to check if it's null, as
it can never be null.

Signed-off-by: Xin Long <lucien.xin@gmail.com>
Acked-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Xin Long authored and David S. Miller committed Jul 1, 2017
1 parent 0b58e6d commit 7f304b9
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions net/sctp/endpointola.c
Original file line number Diff line number Diff line change
Expand Up @@ -268,16 +268,14 @@ static void sctp_endpoint_destroy(struct sctp_endpoint *ep)

memset(ep->secret_key, 0, sizeof(ep->secret_key));

/* Give up our hold on the sock. */
sk = ep->base.sk;
if (sk != NULL) {
/* Remove and free the port */
if (sctp_sk(sk)->bind_hash)
sctp_put_port(sk);
/* Remove and free the port */
if (sctp_sk(sk)->bind_hash)
sctp_put_port(sk);

sctp_sk(sk)->ep = NULL;
sock_put(sk);
}
sctp_sk(sk)->ep = NULL;
/* Give up our hold on the sock */
sock_put(sk);

kfree(ep);
SCTP_DBG_OBJCNT_DEC(ep);
Expand Down

0 comments on commit 7f304b9

Please sign in to comment.