Message ID | 20240115044200.27922-1-kunyu@nfschina.com |
---|---|
State | New |
Headers | |
Series | proc: proc_sysctl: Optimize insert_links() | |
Commit Message
diff --git a/fs/proc/proc_sysctl.c b/fs/proc/proc_sysctl.c index cdda684551599..737071754a6e5 100644 --- a/fs/proc/proc_sysctl.c +++ b/fs/proc/proc_sysctl.c @@ -1258,13 +1258,14 @@ static int insert_links(struct ctl_table_header *head) links = new_links(core_parent, head); spin_lock(&sysctl_lock); - err = -ENOMEM; - if (!links) + if (!links) { + err = -ENOMEM; goto out; + } - err = 0; if (get_links(core_parent, head, head->root)) { kfree(links); + err = 0; goto out; }