The only error from fib_insert_node is if memory allocation fails, so instead of passing by reference, just use the convention of returning NULL. Signed-off-by: Stephen Hemminger --- a/net/ipv4/fib_trie.c 2008-01-11 22:04:08.000000000 -0800 +++ b/net/ipv4/fib_trie.c 2008-01-11 22:04:33.000000000 -0800 @@ -980,8 +980,7 @@ static struct node *trie_rebalance(struc /* only used from updater-side */ -static struct list_head * -fib_insert_node(struct trie *t, int *err, u32 key, int plen) +static struct list_head *fib_insert_node(struct trie *t, u32 key, int plen) { int pos, newpos; struct tnode *tp = NULL, *tn = NULL; @@ -1043,10 +1042,8 @@ fib_insert_node(struct trie *t, int *err li = leaf_info_new(plen); - if (!li) { - *err = -ENOMEM; - goto done; - } + if (!li) + return NULL; fa_head = &li->falh; insert_leaf_info(&l->list, li); @@ -1054,18 +1051,15 @@ fib_insert_node(struct trie *t, int *err } l = leaf_new(); - if (!l) { - *err = -ENOMEM; - goto done; - } + if (!l) + return NULL; l->key = key; li = leaf_info_new(plen); if (!li) { tnode_free((struct tnode *) l); - *err = -ENOMEM; - goto done; + return NULL; } fa_head = &li->falh; @@ -1101,8 +1095,7 @@ fib_insert_node(struct trie *t, int *err if (!tn) { free_leaf_info(li); tnode_free((struct tnode *) l); - *err = -ENOMEM; - goto done; + return NULL; } node_set_parent((struct node *)tn, tp); @@ -1258,10 +1251,11 @@ static int fn_trie_insert(struct fib_tab */ if (!fa_head) { - err = 0; - fa_head = fib_insert_node(t, &err, key, plen); - if (err) + fa_head = fib_insert_node(t, key, plen); + if (unlikely(!fa_head)) { + err = -ENOMEM; goto out_free_new_fa; + } } list_add_tail_rcu(&new_fa->fa_list, -- Stephen Hemminger -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html