diff options
author | Xin Long <lucien.xin@gmail.com> | 2017-06-29 17:28:06 +0800 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-07-01 08:46:57 -0700 |
commit | 7f304b9efabbad584b093289d135bebdc09b222e (patch) | |
tree | 642f552182981afc362099000ea75d3922e7b805 /net/sctp/endpointola.c | |
parent | 0b58e6db0fa6382bf9ea50cf6779d9d7b44a033e (diff) | |
download | linux-7f304b9efabbad584b093289d135bebdc09b222e.tar.gz linux-7f304b9efabbad584b093289d135bebdc09b222e.tar.bz2 linux-7f304b9efabbad584b093289d135bebdc09b222e.zip |
sctp: remove an unnecessary check from sctp_endpoint_destroy
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>
Diffstat (limited to 'net/sctp/endpointola.c')
-rw-r--r-- | net/sctp/endpointola.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/net/sctp/endpointola.c b/net/sctp/endpointola.c index 3dcd0ecf3d99..7772ca40ddaf 100644 --- a/net/sctp/endpointola.c +++ b/net/sctp/endpointola.c @@ -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); |