netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] mcast: do not check 'rv' twice in a row
@ 2013-02-04  7:34 Jean Sacren
  2013-02-04 18:33 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Jean Sacren @ 2013-02-04  7:34 UTC (permalink / raw)
  To: netdev

With the loop, don't check 'rv' twice in a row. Without the loop, 'rv'
doesn't even need to be checked.

Make the comment more grammar-friendly.

Signed-off-by: Jean Sacren <sakiwit@gmail.com>
---
 net/ipv6/mcast.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/net/ipv6/mcast.c b/net/ipv6/mcast.c
index 8460a1f..e5de4855 100644
--- a/net/ipv6/mcast.c
+++ b/net/ipv6/mcast.c
@@ -427,11 +427,9 @@ int ip6_mc_source(int add, int omode, struct sock *sk,
 	rv = 1;	/* > 0 for insert logic below if sl_count is 0 */
 	for (i=0; i<psl->sl_count; i++) {
 		rv = !ipv6_addr_equal(&psl->sl_addr[i], source);
-		if (rv == 0)
-			break;
+		if (rv == 0) /* There is an error in the address. */
+			goto done;
 	}
-	if (rv == 0)		/* address already there is an error */
-		goto done;
 	for (j=psl->sl_count-1; j>=i; j--)
 		psl->sl_addr[j+1] = psl->sl_addr[j];
 	psl->sl_addr[i] = *source;

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

* Re: [PATCH net-next] mcast: do not check 'rv' twice in a row
  2013-02-04  7:34 [PATCH net-next] mcast: do not check 'rv' twice in a row Jean Sacren
@ 2013-02-04 18:33 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2013-02-04 18:33 UTC (permalink / raw)
  To: sakiwit; +Cc: netdev

From: Jean Sacren <sakiwit@gmail.com>
Date: Mon,  4 Feb 2013 00:34:10 -0700

> With the loop, don't check 'rv' twice in a row. Without the loop, 'rv'
> doesn't even need to be checked.
> 
> Make the comment more grammar-friendly.
> 
> Signed-off-by: Jean Sacren <sakiwit@gmail.com>

Applied.

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

end of thread, other threads:[~2013-02-04 18:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-04  7:34 [PATCH net-next] mcast: do not check 'rv' twice in a row Jean Sacren
2013-02-04 18:33 ` 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).