From: Xin Long Date: Thu, 29 Jun 2017 09:28:06 +0000 (+0800) Subject: sctp: remove an unnecessary check from sctp_endpoint_destroy X-Git-Tag: Ubuntu-5.10.0-12.13~9993^2~48 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=7f304b9efabbad584b093289d135bebdc09b222e;p=mirror_ubuntu-hirsute-kernel.git 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 Acked-by: Marcelo Ricardo Leitner Signed-off-by: David S. Miller --- 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);