ipv6/mcast: join error paths using goto
authorIlpo Järvinen <ilpo.jarvinen@helsinki.fi>
Mon, 15 Dec 2008 07:15:21 +0000 (23:15 -0800)
committerDavid S. Miller <davem@davemloft.net>
Mon, 15 Dec 2008 07:15:21 +0000 (23:15 -0800)
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv6/mcast.c

index 0f38960328309fe794af7e920c4083863d1633f5..a51fb33e6864f7d588c8ed81821378d710081411 100644 (file)
@@ -303,20 +303,23 @@ static struct inet6_dev *ip6_mc_find_dev(struct net *net,
                dev = dev_get_by_index(net, ifindex);
 
        if (!dev)
-               return NULL;
+               goto nodev;
        idev = in6_dev_get(dev);
-       if (!idev) {
-               dev_put(dev);
-               return NULL;
-       }
+       if (!idev)
+               goto release;
        read_lock_bh(&idev->lock);
-       if (idev->dead) {
-               read_unlock_bh(&idev->lock);
-               in6_dev_put(idev);
-               dev_put(dev);
-               return NULL;
-       }
+       if (idev->dead)
+               goto unlock_release;
+
        return idev;
+
+unlock_release:
+       read_unlock_bh(&idev->lock);
+       in6_dev_put(idev);
+release:
+       dev_put(dev);
+nodev:
+       return NULL;
 }
 
 void ipv6_sock_mc_close(struct sock *sk)