diff options
author | Lin Ming <mlin@ss.pku.edu.cn> | 2012-09-25 11:17:07 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-09-28 18:48:28 -0400 |
commit | 188c517a050ec5b123e72cab76ea213721e5bd9d (patch) | |
tree | ac2c7777a1e61f45e803ec5d0e038ecfc5b77343 /net | |
parent | 24cad1b4ce9e9da6ec22cfc9361bbbe0ba4f80cc (diff) |
ipv6: return errno pointers consistently for fib6_add_1()
fib6_add_1() should consistently return errno pointers,
rather than a mixture of NULL and errno pointers.
Signed-off-by: Lin Ming <mlin@ss.pku.edu.cn>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/ipv6/ip6_fib.c | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c index 286acfc21250..24995a93ef8c 100644 --- a/net/ipv6/ip6_fib.c +++ b/net/ipv6/ip6_fib.c | |||
@@ -514,7 +514,7 @@ static struct fib6_node * fib6_add_1(struct fib6_node *root, void *addr, | |||
514 | ln = node_alloc(); | 514 | ln = node_alloc(); |
515 | 515 | ||
516 | if (!ln) | 516 | if (!ln) |
517 | return NULL; | 517 | return ERR_PTR(-ENOMEM); |
518 | ln->fn_bit = plen; | 518 | ln->fn_bit = plen; |
519 | 519 | ||
520 | ln->parent = pn; | 520 | ln->parent = pn; |
@@ -561,7 +561,7 @@ insert_above: | |||
561 | node_free(in); | 561 | node_free(in); |
562 | if (ln) | 562 | if (ln) |
563 | node_free(ln); | 563 | node_free(ln); |
564 | return NULL; | 564 | return ERR_PTR(-ENOMEM); |
565 | } | 565 | } |
566 | 566 | ||
567 | /* | 567 | /* |
@@ -611,7 +611,7 @@ insert_above: | |||
611 | ln = node_alloc(); | 611 | ln = node_alloc(); |
612 | 612 | ||
613 | if (!ln) | 613 | if (!ln) |
614 | return NULL; | 614 | return ERR_PTR(-ENOMEM); |
615 | 615 | ||
616 | ln->fn_bit = plen; | 616 | ln->fn_bit = plen; |
617 | 617 | ||
@@ -777,11 +777,8 @@ int fib6_add(struct fib6_node *root, struct rt6_info *rt, struct nl_info *info) | |||
777 | 777 | ||
778 | if (IS_ERR(fn)) { | 778 | if (IS_ERR(fn)) { |
779 | err = PTR_ERR(fn); | 779 | err = PTR_ERR(fn); |
780 | fn = NULL; | ||
781 | } | ||
782 | |||
783 | if (!fn) | ||
784 | goto out; | 780 | goto out; |
781 | } | ||
785 | 782 | ||
786 | pn = fn; | 783 | pn = fn; |
787 | 784 | ||
@@ -820,15 +817,12 @@ int fib6_add(struct fib6_node *root, struct rt6_info *rt, struct nl_info *info) | |||
820 | allow_create, replace_required); | 817 | allow_create, replace_required); |
821 | 818 | ||
822 | if (IS_ERR(sn)) { | 819 | if (IS_ERR(sn)) { |
823 | err = PTR_ERR(sn); | ||
824 | sn = NULL; | ||
825 | } | ||
826 | if (!sn) { | ||
827 | /* If it is failed, discard just allocated | 820 | /* If it is failed, discard just allocated |
828 | root, and then (in st_failure) stale node | 821 | root, and then (in st_failure) stale node |
829 | in main tree. | 822 | in main tree. |
830 | */ | 823 | */ |
831 | node_free(sfn); | 824 | node_free(sfn); |
825 | err = PTR_ERR(sn); | ||
832 | goto st_failure; | 826 | goto st_failure; |
833 | } | 827 | } |
834 | 828 | ||
@@ -843,10 +837,8 @@ int fib6_add(struct fib6_node *root, struct rt6_info *rt, struct nl_info *info) | |||
843 | 837 | ||
844 | if (IS_ERR(sn)) { | 838 | if (IS_ERR(sn)) { |
845 | err = PTR_ERR(sn); | 839 | err = PTR_ERR(sn); |
846 | sn = NULL; | ||
847 | } | ||
848 | if (!sn) | ||
849 | goto st_failure; | 840 | goto st_failure; |
841 | } | ||
850 | } | 842 | } |
851 | 843 | ||
852 | if (!fn->leaf) { | 844 | if (!fn->leaf) { |