When an error occurs in inet_csk_accept(), what we should do is
only call release_sock() and set the errno to arg->err.
But the path jumps to another label, which introduces unnecessary
initialisation and tests for newsk.
Let's simplify the error path and remove the redundant NULL
checks for newsk.
Signed-off-by: Kuniyuki Iwashima <kuniyu@google.com>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Reviewed-by: Shakeel Butt <shakeel.butt@linux.dev>
Link: https://patch.msgid.link/20250815201712.1745332-4-kuniyu@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
                spin_unlock_bh(&queue->fastopenq.lock);
        }
 
-out:
        release_sock(sk);
-       if (newsk && mem_cgroup_sockets_enabled) {
+
+       if (mem_cgroup_sockets_enabled) {
                gfp_t gfp = GFP_KERNEL | __GFP_NOFAIL;
                int amt = 0;
 
 
                release_sock(newsk);
        }
+
        if (req)
                reqsk_put(req);
 
-       if (newsk)
-               inet_init_csk_locks(newsk);
-
+       inet_init_csk_locks(newsk);
        return newsk;
+
 out_err:
-       newsk = NULL;
-       req = NULL;
+       release_sock(sk);
        arg->err = error;
-       goto out;
+       return NULL;
 }
 EXPORT_SYMBOL(inet_csk_accept);