netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] [IPV6]: kill needless initialization and comparison.
@ 2005-01-19  5:18 YOSHIFUJI Hideaki / 吉藤英明
  2005-01-19 22:04 ` David S. Miller
  0 siblings, 1 reply; 2+ messages in thread
From: YOSHIFUJI Hideaki / 吉藤英明 @ 2005-01-19  5:18 UTC (permalink / raw)
  To: davem; +Cc: yoshfuji, netdev

Hello.

I believe that compilers are clever enough, but anyway...

Thanks.

----
[IPV6] kill needless initialization and comparison.

Signed-off-by: Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>

diff -Nru a/net/ipv6/icmp.c b/net/ipv6/icmp.c
--- a/net/ipv6/icmp.c	2005-01-19 14:10:16 +09:00
+++ b/net/ipv6/icmp.c	2005-01-19 14:10:16 +09:00
@@ -287,7 +287,7 @@
 	int iif = 0;
 	int addr_type = 0;
 	int len;
-	int hlimit = -1;
+	int hlimit;
 	int err = 0;
 
 	if ((u8*)hdr < skb->head || (u8*)(hdr+1) > skb->tail)
@@ -375,14 +375,12 @@
 	if ((err = xfrm_lookup(&dst, &fl, sk, 0)) < 0)
 		goto out_dst_release;
 
-	if (hlimit < 0) {
-		if (ipv6_addr_is_multicast(&fl.fl6_dst))
-			hlimit = np->mcast_hops;
-		else
-			hlimit = np->hop_limit;
-		if (hlimit < 0)
-			hlimit = dst_metric(dst, RTAX_HOPLIMIT);
-	}
+	if (ipv6_addr_is_multicast(&fl.fl6_dst))
+		hlimit = np->mcast_hops;
+	else
+		hlimit = np->hop_limit;
+	if (hlimit < 0)
+		hlimit = dst_metric(dst, RTAX_HOPLIMIT);
 
 	msg.skb = skb;
 	msg.offset = skb->nh.raw - skb->data;
@@ -433,7 +431,7 @@
 	struct icmpv6_msg msg;
 	struct dst_entry *dst;
 	int err = 0;
-	int hlimit = -1;
+	int hlimit;
 
 	saddr = &skb->nh.ipv6h->daddr;
 
@@ -463,14 +461,12 @@
 	if ((err = xfrm_lookup(&dst, &fl, sk, 0)) < 0)
 		goto out_dst_release;
 
-	if (hlimit < 0) {
-		if (ipv6_addr_is_multicast(&fl.fl6_dst))
-			hlimit = np->mcast_hops;
-		else
-			hlimit = np->hop_limit;
-		if (hlimit < 0)
-			hlimit = dst_metric(dst, RTAX_HOPLIMIT);
-	}
+	if (ipv6_addr_is_multicast(&fl.fl6_dst))
+		hlimit = np->mcast_hops;
+	else
+		hlimit = np->hop_limit;
+	if (hlimit < 0)
+		hlimit = dst_metric(dst, RTAX_HOPLIMIT);
 
 	idev = in6_dev_get(skb->dev);
 

-- 
Hideaki YOSHIFUJI @ USAGI Project <yoshfuji@linux-ipv6.org>
GPG FP: 9022 65EB 1ECF 3AD1 0BDF  80D8 4807 F894 E062 0EEA

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

* Re: [PATCH] [IPV6]: kill needless initialization and comparison.
  2005-01-19  5:18 [PATCH] [IPV6]: kill needless initialization and comparison YOSHIFUJI Hideaki / 吉藤英明
@ 2005-01-19 22:04 ` David S. Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David S. Miller @ 2005-01-19 22:04 UTC (permalink / raw)
  To: yoshfuji; +Cc: netdev

On Wed, 19 Jan 2005 14:18:17 +0900 (JST)
YOSHIFUJI Hideaki / ^[$B5HF#1QL@^[(B <yoshfuji@linux-ipv6.org> wrote:

> I believe that compilers are clever enough, but anyway...

Applied, thanks.

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

end of thread, other threads:[~2005-01-19 22:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-01-19  5:18 [PATCH] [IPV6]: kill needless initialization and comparison YOSHIFUJI Hideaki / 吉藤英明
2005-01-19 22:04 ` David S. 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).