Commit 448eb71f40120a8fd11ebd58153c271c63e6f862

Authored by Ilpo Järvinen
Committed by David S. Miller
1 parent 5ce1bbb97b

ipv6/mcast: join error paths using goto

Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi>
Signed-off-by: David S. Miller <davem@davemloft.net>

Showing 1 changed file with 14 additions and 11 deletions Side-by-side Diff

... ... @@ -303,20 +303,23 @@
303 303 dev = dev_get_by_index(net, ifindex);
304 304  
305 305 if (!dev)
306   - return NULL;
  306 + goto nodev;
307 307 idev = in6_dev_get(dev);
308   - if (!idev) {
309   - dev_put(dev);
310   - return NULL;
311   - }
  308 + if (!idev)
  309 + goto release;
312 310 read_lock_bh(&idev->lock);
313   - if (idev->dead) {
314   - read_unlock_bh(&idev->lock);
315   - in6_dev_put(idev);
316   - dev_put(dev);
317   - return NULL;
318   - }
  311 + if (idev->dead)
  312 + goto unlock_release;
  313 +
319 314 return idev;
  315 +
  316 +unlock_release:
  317 + read_unlock_bh(&idev->lock);
  318 + in6_dev_put(idev);
  319 +release:
  320 + dev_put(dev);
  321 +nodev:
  322 + return NULL;
320 323 }
321 324  
322 325 void ipv6_sock_mc_close(struct sock *sk)