mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-11 21:38:32 +08:00
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>
This commit is contained in:
parent
24cad1b4ce
commit
188c517a05
@ -514,7 +514,7 @@ static struct fib6_node * fib6_add_1(struct fib6_node *root, void *addr,
|
|||||||
ln = node_alloc();
|
ln = node_alloc();
|
||||||
|
|
||||||
if (!ln)
|
if (!ln)
|
||||||
return NULL;
|
return ERR_PTR(-ENOMEM);
|
||||||
ln->fn_bit = plen;
|
ln->fn_bit = plen;
|
||||||
|
|
||||||
ln->parent = pn;
|
ln->parent = pn;
|
||||||
@ -561,7 +561,7 @@ insert_above:
|
|||||||
node_free(in);
|
node_free(in);
|
||||||
if (ln)
|
if (ln)
|
||||||
node_free(ln);
|
node_free(ln);
|
||||||
return NULL;
|
return ERR_PTR(-ENOMEM);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -611,7 +611,7 @@ insert_above:
|
|||||||
ln = node_alloc();
|
ln = node_alloc();
|
||||||
|
|
||||||
if (!ln)
|
if (!ln)
|
||||||
return NULL;
|
return ERR_PTR(-ENOMEM);
|
||||||
|
|
||||||
ln->fn_bit = plen;
|
ln->fn_bit = plen;
|
||||||
|
|
||||||
@ -777,11 +777,8 @@ int fib6_add(struct fib6_node *root, struct rt6_info *rt, struct nl_info *info)
|
|||||||
|
|
||||||
if (IS_ERR(fn)) {
|
if (IS_ERR(fn)) {
|
||||||
err = PTR_ERR(fn);
|
err = PTR_ERR(fn);
|
||||||
fn = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!fn)
|
|
||||||
goto out;
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
pn = fn;
|
pn = fn;
|
||||||
|
|
||||||
@ -820,15 +817,12 @@ int fib6_add(struct fib6_node *root, struct rt6_info *rt, struct nl_info *info)
|
|||||||
allow_create, replace_required);
|
allow_create, replace_required);
|
||||||
|
|
||||||
if (IS_ERR(sn)) {
|
if (IS_ERR(sn)) {
|
||||||
err = PTR_ERR(sn);
|
|
||||||
sn = NULL;
|
|
||||||
}
|
|
||||||
if (!sn) {
|
|
||||||
/* If it is failed, discard just allocated
|
/* If it is failed, discard just allocated
|
||||||
root, and then (in st_failure) stale node
|
root, and then (in st_failure) stale node
|
||||||
in main tree.
|
in main tree.
|
||||||
*/
|
*/
|
||||||
node_free(sfn);
|
node_free(sfn);
|
||||||
|
err = PTR_ERR(sn);
|
||||||
goto st_failure;
|
goto st_failure;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -843,11 +837,9 @@ int fib6_add(struct fib6_node *root, struct rt6_info *rt, struct nl_info *info)
|
|||||||
|
|
||||||
if (IS_ERR(sn)) {
|
if (IS_ERR(sn)) {
|
||||||
err = PTR_ERR(sn);
|
err = PTR_ERR(sn);
|
||||||
sn = NULL;
|
|
||||||
}
|
|
||||||
if (!sn)
|
|
||||||
goto st_failure;
|
goto st_failure;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!fn->leaf) {
|
if (!fn->leaf) {
|
||||||
fn->leaf = rt;
|
fn->leaf = rt;
|
||||||
|
Loading…
Reference in New Issue
Block a user