diff options
author | Ilpo Järvinen <ilpo.jarvinen@helsinki.fi> | 2008-12-15 02:13:48 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-12-15 02:13:48 -0500 |
commit | 5ce1bbb97bf1e6707102d30499e7feaa1e6a2134 (patch) | |
tree | ea00308023d60ccdbf142e0fab92fe8bfc018934 /net/ipv6/xfrm6_tunnel.c | |
parent | 857a6e0a4d8db0bbee685ccc97c6bd7987e7aede (diff) |
xfrm6_tunnel: join error paths using goto
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6/xfrm6_tunnel.c')
-rw-r--r-- | net/ipv6/xfrm6_tunnel.c | 33 |
1 files changed, 16 insertions, 17 deletions
diff --git a/net/ipv6/xfrm6_tunnel.c b/net/ipv6/xfrm6_tunnel.c index c2b278138604..80193db224d9 100644 --- a/net/ipv6/xfrm6_tunnel.c +++ b/net/ipv6/xfrm6_tunnel.c | |||
@@ -345,24 +345,23 @@ static struct xfrm6_tunnel xfrm46_tunnel_handler = { | |||
345 | static int __init xfrm6_tunnel_init(void) | 345 | static int __init xfrm6_tunnel_init(void) |
346 | { | 346 | { |
347 | if (xfrm_register_type(&xfrm6_tunnel_type, AF_INET6) < 0) | 347 | if (xfrm_register_type(&xfrm6_tunnel_type, AF_INET6) < 0) |
348 | return -EAGAIN; | 348 | goto err; |
349 | 349 | if (xfrm6_tunnel_register(&xfrm6_tunnel_handler, AF_INET6)) | |
350 | if (xfrm6_tunnel_register(&xfrm6_tunnel_handler, AF_INET6)) { | 350 | goto unreg; |
351 | xfrm_unregister_type(&xfrm6_tunnel_type, AF_INET6); | 351 | if (xfrm6_tunnel_register(&xfrm46_tunnel_handler, AF_INET)) |
352 | return -EAGAIN; | 352 | goto dereg6; |
353 | } | 353 | if (xfrm6_tunnel_spi_init() < 0) |
354 | if (xfrm6_tunnel_register(&xfrm46_tunnel_handler, AF_INET)) { | 354 | goto dereg46; |
355 | xfrm6_tunnel_deregister(&xfrm6_tunnel_handler, AF_INET6); | ||
356 | xfrm_unregister_type(&xfrm6_tunnel_type, AF_INET6); | ||
357 | return -EAGAIN; | ||
358 | } | ||
359 | if (xfrm6_tunnel_spi_init() < 0) { | ||
360 | xfrm6_tunnel_deregister(&xfrm46_tunnel_handler, AF_INET); | ||
361 | xfrm6_tunnel_deregister(&xfrm6_tunnel_handler, AF_INET6); | ||
362 | xfrm_unregister_type(&xfrm6_tunnel_type, AF_INET6); | ||
363 | return -EAGAIN; | ||
364 | } | ||
365 | return 0; | 355 | return 0; |
356 | |||
357 | dereg46: | ||
358 | xfrm6_tunnel_deregister(&xfrm46_tunnel_handler, AF_INET); | ||
359 | dereg6: | ||
360 | xfrm6_tunnel_deregister(&xfrm6_tunnel_handler, AF_INET6); | ||
361 | unreg: | ||
362 | xfrm_unregister_type(&xfrm6_tunnel_type, AF_INET6); | ||
363 | err: | ||
364 | return -EAGAIN; | ||
366 | } | 365 | } |
367 | 366 | ||
368 | static void __exit xfrm6_tunnel_fini(void) | 367 | static void __exit xfrm6_tunnel_fini(void) |