netdev
[Top] [All Lists]

[PATCH] [IPV6]: kill needless initialization and comparison.

To: davem@xxxxxxxxxxxxx
Subject: [PATCH] [IPV6]: kill needless initialization and comparison.
From: YOSHIFUJI Hideaki / 吉藤英明 <yoshfuji@xxxxxxxxxxxxxx>
Date: Wed, 19 Jan 2005 14:18:17 +0900 (JST)
Cc: yoshfuji@xxxxxxxxxxxxxx, netdev@xxxxxxxxxxx
Organization: USAGI Project
Sender: netdev-bounce@xxxxxxxxxxx
Hello.

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

Thanks.

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

Signed-off-by: Hideaki YOSHIFUJI <yoshfuji@xxxxxxxxxxxxxx>

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@xxxxxxxxxxxxxx>
GPG FP: 9022 65EB 1ECF 3AD1 0BDF  80D8 4807 F894 E062 0EEA

<Prev in Thread] Current Thread [Next in Thread>