linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 4/9] net/sctp: Eliminate useless code
@ 2010-01-16 15:58 Julia Lawall
  2010-01-20 18:10 ` Vlad Yasevich
  0 siblings, 1 reply; 8+ messages in thread
From: Julia Lawall @ 2010-01-16 15:58 UTC (permalink / raw)
  To: Vlad Yasevich, Sridhar Samudrala, David S. Miller, linux-sctp,
	netdev, linux-kernel, kernel-janitors

From: Julia Lawall <julia@diku.dk>

The variable newinet is initialized twice to the same (side effect-free)
expression.  Drop one initialization.

A simplified version of the semantic match that finds this problem is:
(http://coccinelle.lip6.fr/)

// <smpl>
@forall@
idexpression *x;
identifier f!=ERR_PTR;
@@

x = f(...)
... when != x
(
x = f(...,<+...x...+>,...)
|
* x = f(...)
)
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>

---
 net/sctp/socket.c                   |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/net/sctp/socket.c b/net/sctp/socket.c
index 67fdac9..f6d1e59 100644
--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -6359,7 +6359,7 @@ void sctp_copy_sock(struct sock *newsk, struct sock *sk,
 		    struct sctp_association *asoc)
 {
 	struct inet_sock *inet = inet_sk(sk);
-	struct inet_sock *newinet = inet_sk(newsk);
+	struct inet_sock *newinet;
 
 	newsk->sk_type = sk->sk_type;
 	newsk->sk_bound_dev_if = sk->sk_bound_dev_if;

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

* Re: [PATCH 4/9] net/sctp: Eliminate useless code
  2010-01-16 15:58 [PATCH 4/9] net/sctp: Eliminate useless code Julia Lawall
@ 2010-01-20 18:10 ` Vlad Yasevich
  2010-01-20 23:03   ` David Miller
  0 siblings, 1 reply; 8+ messages in thread
From: Vlad Yasevich @ 2010-01-20 18:10 UTC (permalink / raw)
  To: Julia Lawall
  Cc: Sridhar Samudrala, David S. Miller, linux-sctp, netdev,
	linux-kernel, kernel-janitors



Julia Lawall wrote:
> From: Julia Lawall <julia@diku.dk>
> 
> The variable newinet is initialized twice to the same (side effect-free)
> expression.  Drop one initialization.
> 
> A simplified version of the semantic match that finds this problem is:
> (http://coccinelle.lip6.fr/)
> 
> // <smpl>
> @forall@
> idexpression *x;
> identifier f!=ERR_PTR;
> @@
> 
> x = f(...)
> ... when != x
> (
> x = f(...,<+...x...+>,...)
> |
> * x = f(...)
> )
> // </smpl>
> 
> Signed-off-by: Julia Lawall <julia@diku.dk>

Acked-by: Vlad Yasevich <vladislav.yasevich@hp.com>


> 
> ---
>  net/sctp/socket.c                   |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/net/sctp/socket.c b/net/sctp/socket.c
> index 67fdac9..f6d1e59 100644
> --- a/net/sctp/socket.c
> +++ b/net/sctp/socket.c
> @@ -6359,7 +6359,7 @@ void sctp_copy_sock(struct sock *newsk, struct sock *sk,
>  		    struct sctp_association *asoc)
>  {
>  	struct inet_sock *inet = inet_sk(sk);
> -	struct inet_sock *newinet = inet_sk(newsk);
> +	struct inet_sock *newinet;
>  
>  	newsk->sk_type = sk->sk_type;
>  	newsk->sk_bound_dev_if = sk->sk_bound_dev_if;
> 

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

* Re: [PATCH 4/9] net/sctp: Eliminate useless code
  2010-01-20 18:10 ` Vlad Yasevich
@ 2010-01-20 23:03   ` David Miller
  2010-01-21 10:21     ` Julia Lawall
  2010-01-21 10:22     ` Julia Lawall
  0 siblings, 2 replies; 8+ messages in thread
From: David Miller @ 2010-01-20 23:03 UTC (permalink / raw)
  To: vladislav.yasevich
  Cc: julia, sri, linux-sctp, netdev, linux-kernel, kernel-janitors

From: Vlad Yasevich <vladislav.yasevich@hp.com>
Date: Wed, 20 Jan 2010 13:10:10 -0500

> 
> 
> Julia Lawall wrote:
>> From: Julia Lawall <julia@diku.dk>
>> 
>> The variable newinet is initialized twice to the same (side effect-free)
>> expression.  Drop one initialization.
>> 
>> A simplified version of the semantic match that finds this problem is:
>> (http://coccinelle.lip6.fr/)
>> 
>> // <smpl>
>> @forall@
>> idexpression *x;
>> identifier f!=ERR_PTR;
>> @@
>> 
>> x = f(...)
>> ... when != x
>> (
>> x = f(...,<+...x...+>,...)
>> |
>> * x = f(...)
>> )
>> // </smpl>
>> 
>> Signed-off-by: Julia Lawall <julia@diku.dk>
> 
> Acked-by: Vlad Yasevich <vladislav.yasevich@hp.com>

Julia,  just like patch #3 this one had the missing final
line of the patch corrupting it, so you'll need to resubmit.

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

* Re: [PATCH 4/9] net/sctp: Eliminate useless code
  2010-01-20 23:03   ` David Miller
@ 2010-01-21 10:21     ` Julia Lawall
  2010-01-21 10:22     ` Julia Lawall
  1 sibling, 0 replies; 8+ messages in thread
From: Julia Lawall @ 2010-01-21 10:21 UTC (permalink / raw)
  To: David Miller
  Cc: vladislav.yasevich, sri, linux-sctp, netdev, linux-kernel,
	kernel-janitors

From: Julia Lawall <julia@diku.dk>

The variable newinet is initialized twice to the same (side effect-free)
expression.  Drop one initialization.

A simplified version of the semantic match that finds this problem is:
(http://coccinelle.lip6.fr/)

// <smpl>
@forall@
idexpression *x;
identifier f!=ERR_PTR;
@@

x = f(...)
... when != x
(
x = f(...,<+...x...+>,...)
|
* x = f(...)
)
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>

---
 net/sctp/socket.c                   |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/net/sctp/socket.c b/net/sctp/socket.c
index 67fdac9..f6d1e59 100644
--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -6359,7 +6359,7 @@ void sctp_copy_sock(struct sock *newsk, struct sock *sk,
 		    struct sctp_association *asoc)
 {
 	struct inet_sock *inet = inet_sk(sk);
-	struct inet_sock *newinet = inet_sk(newsk);
+	struct inet_sock *newinet;
 
 	newsk->sk_type = sk->sk_type;
 	newsk->sk_bound_dev_if = sk->sk_bound_dev_if;

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

* Re: [PATCH 4/9] net/sctp: Eliminate useless code
  2010-01-20 23:03   ` David Miller
  2010-01-21 10:21     ` Julia Lawall
@ 2010-01-21 10:22     ` Julia Lawall
  2010-01-21 10:43       ` David Miller
  1 sibling, 1 reply; 8+ messages in thread
From: Julia Lawall @ 2010-01-21 10:22 UTC (permalink / raw)
  To: David Miller
  Cc: vladislav.yasevich, sri, linux-sctp, netdev, linux-kernel,
	kernel-janitors

On Wed, 20 Jan 2010, David Miller wrote:

> From: Vlad Yasevich <vladislav.yasevich@hp.com>
> Date: Wed, 20 Jan 2010 13:10:10 -0500
> 
> > 
> > 
> > Julia Lawall wrote:
> >> From: Julia Lawall <julia@diku.dk>
> >> 
> >> The variable newinet is initialized twice to the same (side effect-free)
> >> expression.  Drop one initialization.
> >> 
> >> A simplified version of the semantic match that finds this problem is:
> >> (http://coccinelle.lip6.fr/)
> >> 
> >> // <smpl>
> >> @forall@
> >> idexpression *x;
> >> identifier f!=ERR_PTR;
> >> @@
> >> 
> >> x = f(...)
> >> ... when != x
> >> (
> >> x = f(...,<+...x...+>,...)
> >> |
> >> * x = f(...)
> >> )
> >> // </smpl>
> >> 
> >> Signed-off-by: Julia Lawall <julia@diku.dk>
> > 
> > Acked-by: Vlad Yasevich <vladislav.yasevich@hp.com>
> 
> Julia,  just like patch #3 this one had the missing final
> line of the patch corrupting it, so you'll need to resubmit.

I have generated and sent it again, but this time I don't see the problem.  
If there is still a problem, perhaps you could send me back the patch you 
received?

thanks,
julia

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

* Re: [PATCH 4/9] net/sctp: Eliminate useless code
  2010-01-21 10:22     ` Julia Lawall
@ 2010-01-21 10:43       ` David Miller
  2010-01-21 10:49         ` Julia Lawall
  0 siblings, 1 reply; 8+ messages in thread
From: David Miller @ 2010-01-21 10:43 UTC (permalink / raw)
  To: julia
  Cc: vladislav.yasevich, sri, linux-sctp, netdev, linux-kernel,
	kernel-janitors

From: Julia Lawall <julia@diku.dk>
Date: Thu, 21 Jan 2010 11:22:38 +0100 (CET)

> On Wed, 20 Jan 2010, David Miller wrote:
> 
>> From: Vlad Yasevich <vladislav.yasevich@hp.com>
>> Date: Wed, 20 Jan 2010 13:10:10 -0500
>> 
>> > 
>> > 
>> > Julia Lawall wrote:
>> >> From: Julia Lawall <julia@diku.dk>
>> >> 
>> >> The variable newinet is initialized twice to the same (side effect-free)
>> >> expression.  Drop one initialization.
>> >> 
>> >> A simplified version of the semantic match that finds this problem is:
>> >> (http://coccinelle.lip6.fr/)
>> >> 
>> >> // <smpl>
>> >> @forall@
>> >> idexpression *x;
>> >> identifier f!=ERR_PTR;
>> >> @@
>> >> 
>> >> x = f(...)
>> >> ... when != x
>> >> (
>> >> x = f(...,<+...x...+>,...)
>> >> |
>> >> * x = f(...)
>> >> )
>> >> // </smpl>
>> >> 
>> >> Signed-off-by: Julia Lawall <julia@diku.dk>
>> > 
>> > Acked-by: Vlad Yasevich <vladislav.yasevich@hp.com>
>> 
>> Julia,  just like patch #3 this one had the missing final
>> line of the patch corrupting it, so you'll need to resubmit.
> 
> I have generated and sent it again, but this time I don't see the problem.  
> If there is still a problem, perhaps you could send me back the patch you 
> received?

You dropped Vlad' ACK in your re-submission.

I'll fix it up this time, but please accumulate ACK's when
resubmitting patches merely for the purpose of fixing some
technical submission problem.

Thanks.

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

* Re: [PATCH 4/9] net/sctp: Eliminate useless code
  2010-01-21 10:43       ` David Miller
@ 2010-01-21 10:49         ` Julia Lawall
  2010-01-21 13:08           ` David Miller
  0 siblings, 1 reply; 8+ messages in thread
From: Julia Lawall @ 2010-01-21 10:49 UTC (permalink / raw)
  To: David Miller
  Cc: vladislav.yasevich, sri, linux-sctp, netdev, linux-kernel,
	kernel-janitors

On Thu, 21 Jan 2010, David Miller wrote:

> From: Julia Lawall <julia@diku.dk>
> Date: Thu, 21 Jan 2010 11:22:38 +0100 (CET)
> 
> > On Wed, 20 Jan 2010, David Miller wrote:
> > 
> >> From: Vlad Yasevich <vladislav.yasevich@hp.com>
> >> Date: Wed, 20 Jan 2010 13:10:10 -0500
> >> 
> >> > 
> >> > 
> >> > Julia Lawall wrote:
> >> >> From: Julia Lawall <julia@diku.dk>
> >> >> 
> >> >> The variable newinet is initialized twice to the same (side effect-free)
> >> >> expression.  Drop one initialization.
> >> >> 
> >> >> A simplified version of the semantic match that finds this problem is:
> >> >> (http://coccinelle.lip6.fr/)
> >> >> 
> >> >> // <smpl>
> >> >> @forall@
> >> >> idexpression *x;
> >> >> identifier f!=ERR_PTR;
> >> >> @@
> >> >> 
> >> >> x = f(...)
> >> >> ... when != x
> >> >> (
> >> >> x = f(...,<+...x...+>,...)
> >> >> |
> >> >> * x = f(...)
> >> >> )
> >> >> // </smpl>
> >> >> 
> >> >> Signed-off-by: Julia Lawall <julia@diku.dk>
> >> > 
> >> > Acked-by: Vlad Yasevich <vladislav.yasevich@hp.com>
> >> 
> >> Julia,  just like patch #3 this one had the missing final
> >> line of the patch corrupting it, so you'll need to resubmit.
> > 
> > I have generated and sent it again, but this time I don't see the problem.  
> > If there is still a problem, perhaps you could send me back the patch you 
> > received?
> 
> You dropped Vlad' ACK in your re-submission.
> 
> I'll fix it up this time, but please accumulate ACK's when
> resubmitting patches merely for the purpose of fixing some
> technical submission problem.
> 
> Thanks.

OK, I will keep that in mind.

Is the new one better than the old one?  Because in my local copies, they 
are the same...

julia

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

* Re: [PATCH 4/9] net/sctp: Eliminate useless code
  2010-01-21 10:49         ` Julia Lawall
@ 2010-01-21 13:08           ` David Miller
  0 siblings, 0 replies; 8+ messages in thread
From: David Miller @ 2010-01-21 13:08 UTC (permalink / raw)
  To: julia
  Cc: vladislav.yasevich, sri, linux-sctp, netdev, linux-kernel,
	kernel-janitors

From: Julia Lawall <julia@diku.dk>
Date: Thu, 21 Jan 2010 11:49:10 +0100 (CET)

> Is the new one better than the old one?  Because in my local copies, they 
> are the same...

The new one worked and I applied it.

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

end of thread, other threads:[~2010-01-21 13:08 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-01-16 15:58 [PATCH 4/9] net/sctp: Eliminate useless code Julia Lawall
2010-01-20 18:10 ` Vlad Yasevich
2010-01-20 23:03   ` David Miller
2010-01-21 10:21     ` Julia Lawall
2010-01-21 10:22     ` Julia Lawall
2010-01-21 10:43       ` David Miller
2010-01-21 10:49         ` Julia Lawall
2010-01-21 13:08           ` 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).