netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] sctp: remove an unnecessary check from sctp_endpoint_destroy
@ 2017-06-29  9:28 Xin Long
  2017-06-30 16:51 ` Marcelo Ricardo Leitner
  2017-07-01 15:47 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Xin Long @ 2017-06-29  9:28 UTC (permalink / raw)
  To: network dev, linux-sctp; +Cc: Marcelo Ricardo Leitner, Neil Horman, davem

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>
---
 net/sctp/endpointola.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/net/sctp/endpointola.c b/net/sctp/endpointola.c
index 3dcd0ec..7772ca4 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);
-- 
2.1.0

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] sctp: remove an unnecessary check from sctp_endpoint_destroy
  2017-06-29  9:28 [PATCH net-next] sctp: remove an unnecessary check from sctp_endpoint_destroy Xin Long
@ 2017-06-30 16:51 ` Marcelo Ricardo Leitner
  2017-07-01 15:47 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: Marcelo Ricardo Leitner @ 2017-06-30 16:51 UTC (permalink / raw)
  To: Xin Long; +Cc: network dev, linux-sctp, Neil Horman, davem

On Thu, Jun 29, 2017 at 05:28:06PM +0800, Xin Long wrote:
> 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>

> ---
>  net/sctp/endpointola.c | 14 ++++++--------
>  1 file changed, 6 insertions(+), 8 deletions(-)
> 
> diff --git a/net/sctp/endpointola.c b/net/sctp/endpointola.c
> index 3dcd0ec..7772ca4 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);
> -- 
> 2.1.0
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-sctp" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] sctp: remove an unnecessary check from sctp_endpoint_destroy
  2017-06-29  9:28 [PATCH net-next] sctp: remove an unnecessary check from sctp_endpoint_destroy Xin Long
  2017-06-30 16:51 ` Marcelo Ricardo Leitner
@ 2017-07-01 15:47 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2017-07-01 15:47 UTC (permalink / raw)
  To: lucien.xin; +Cc: netdev, linux-sctp, marcelo.leitner, nhorman

From: Xin Long <lucien.xin@gmail.com>
Date: Thu, 29 Jun 2017 17:28:06 +0800

> 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>

Applied, thanks.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-07-01 15:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-29  9:28 [PATCH net-next] sctp: remove an unnecessary check from sctp_endpoint_destroy Xin Long
2017-06-30 16:51 ` Marcelo Ricardo Leitner
2017-07-01 15:47 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).