netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] sctp: remove redundant null check on asoc
@ 2013-12-11  8:42 Wang Weidong
  2013-12-11 12:09 ` Neil Horman
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Wang Weidong @ 2013-12-11  8:42 UTC (permalink / raw)
  To: Vlad Yasevich, Neil Horman, David Miller; +Cc: netdev, linux-sctp

In sctp_err_lookup, goto out while the asoc is not NULL, so remove the
check NULL. Also, in sctp_err_finish which called by sctp_v4_err and
sctp_v6_err, they pass asoc to sctp_err_finish while the asoc is not
NULL, so remove the check.

Signed-off-by: Wang Weidong <wangweidong1@huawei.com>
---
 net/sctp/input.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/net/sctp/input.c b/net/sctp/input.c
index 6603853..2a192a7 100644
--- a/net/sctp/input.c
+++ b/net/sctp/input.c
@@ -536,8 +536,7 @@ struct sock *sctp_err_lookup(struct net *net, int family, struct sk_buff *skb,
 	return sk;
 
 out:
-	if (asoc)
-		sctp_association_put(asoc);
+	sctp_association_put(asoc);
 	return NULL;
 }
 
@@ -545,8 +544,7 @@ out:
 void sctp_err_finish(struct sock *sk, struct sctp_association *asoc)
 {
 	sctp_bh_unlock_sock(sk);
-	if (asoc)
-		sctp_association_put(asoc);
+	sctp_association_put(asoc);
 }
 
 /*
-- 
1.7.12

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

* Re: [PATCH net-next] sctp: remove redundant null check on asoc
  2013-12-11  8:42 [PATCH net-next] sctp: remove redundant null check on asoc Wang Weidong
@ 2013-12-11 12:09 ` Neil Horman
  2013-12-11 14:38 ` Vlad Yasevich
  2013-12-11 20:39 ` David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: Neil Horman @ 2013-12-11 12:09 UTC (permalink / raw)
  To: Wang Weidong; +Cc: Vlad Yasevich, David Miller, netdev, linux-sctp

On Wed, Dec 11, 2013 at 04:42:14PM +0800, Wang Weidong wrote:
> In sctp_err_lookup, goto out while the asoc is not NULL, so remove the
> check NULL. Also, in sctp_err_finish which called by sctp_v4_err and
> sctp_v6_err, they pass asoc to sctp_err_finish while the asoc is not
> NULL, so remove the check.
> 
> Signed-off-by: Wang Weidong <wangweidong1@huawei.com>
> ---
>  net/sctp/input.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/net/sctp/input.c b/net/sctp/input.c
> index 6603853..2a192a7 100644
> --- a/net/sctp/input.c
> +++ b/net/sctp/input.c
> @@ -536,8 +536,7 @@ struct sock *sctp_err_lookup(struct net *net, int family, struct sk_buff *skb,
>  	return sk;
>  
>  out:
> -	if (asoc)
> -		sctp_association_put(asoc);
> +	sctp_association_put(asoc);
>  	return NULL;
>  }
>  
> @@ -545,8 +544,7 @@ out:
>  void sctp_err_finish(struct sock *sk, struct sctp_association *asoc)
>  {
>  	sctp_bh_unlock_sock(sk);
> -	if (asoc)
> -		sctp_association_put(asoc);
> +	sctp_association_put(asoc);
>  }
>  
>  /*
> -- 
> 1.7.12
> 
> 
> --
> 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
> 

Seems reasonable
Acked-by: Neil Horman <nhorman@tuxdriver.com>

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

* Re: [PATCH net-next] sctp: remove redundant null check on asoc
  2013-12-11  8:42 [PATCH net-next] sctp: remove redundant null check on asoc Wang Weidong
  2013-12-11 12:09 ` Neil Horman
@ 2013-12-11 14:38 ` Vlad Yasevich
  2013-12-11 20:39 ` David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: Vlad Yasevich @ 2013-12-11 14:38 UTC (permalink / raw)
  To: Wang Weidong, Neil Horman, David Miller; +Cc: netdev, linux-sctp

On 12/11/2013 03:42 AM, Wang Weidong wrote:
> In sctp_err_lookup, goto out while the asoc is not NULL, so remove the
> check NULL. Also, in sctp_err_finish which called by sctp_v4_err and
> sctp_v6_err, they pass asoc to sctp_err_finish while the asoc is not
> NULL, so remove the check.
> 
> Signed-off-by: Wang Weidong <wangweidong1@huawei.com>


Acked-by: Vlad Yasevich <vyasevich@gmail.com>

Thanks
-vlad

> ---
>  net/sctp/input.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/net/sctp/input.c b/net/sctp/input.c
> index 6603853..2a192a7 100644
> --- a/net/sctp/input.c
> +++ b/net/sctp/input.c
> @@ -536,8 +536,7 @@ struct sock *sctp_err_lookup(struct net *net, int family, struct sk_buff *skb,
>  	return sk;
>  
>  out:
> -	if (asoc)
> -		sctp_association_put(asoc);
> +	sctp_association_put(asoc);
>  	return NULL;
>  }
>  
> @@ -545,8 +544,7 @@ out:
>  void sctp_err_finish(struct sock *sk, struct sctp_association *asoc)
>  {
>  	sctp_bh_unlock_sock(sk);
> -	if (asoc)
> -		sctp_association_put(asoc);
> +	sctp_association_put(asoc);
>  }
>  
>  /*
> 

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

* Re: [PATCH net-next] sctp: remove redundant null check on asoc
  2013-12-11  8:42 [PATCH net-next] sctp: remove redundant null check on asoc Wang Weidong
  2013-12-11 12:09 ` Neil Horman
  2013-12-11 14:38 ` Vlad Yasevich
@ 2013-12-11 20:39 ` David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2013-12-11 20:39 UTC (permalink / raw)
  To: wangweidong1; +Cc: vyasevich, nhorman, netdev, linux-sctp

From: Wang Weidong <wangweidong1@huawei.com>
Date: Wed, 11 Dec 2013 16:42:14 +0800

> In sctp_err_lookup, goto out while the asoc is not NULL, so remove the
> check NULL. Also, in sctp_err_finish which called by sctp_v4_err and
> sctp_v6_err, they pass asoc to sctp_err_finish while the asoc is not
> NULL, so remove the check.
> 
> Signed-off-by: Wang Weidong <wangweidong1@huawei.com>

Applied, thanks.

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

end of thread, other threads:[~2013-12-11 20:40 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-11  8:42 [PATCH net-next] sctp: remove redundant null check on asoc Wang Weidong
2013-12-11 12:09 ` Neil Horman
2013-12-11 14:38 ` Vlad Yasevich
2013-12-11 20:39 ` 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).