The error handling path at label 'accept_err' already performs these 'sock_release()' and 'mutex_unlock()' calls. The order is reversed, but it is not important. So avoid code duplication and 'goto accept_err'. While at it, add some missing spaces around a '='. Signed-off-by: Christophe JAILLET <christophe.jaillet@xxxxxxxxxx> --- Instead of returning the magic number -1, we could also propagate the return value of 'addr_to_nodeid()', that is to say -EEXIST --- fs/dlm/lowcomms.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/fs/dlm/lowcomms.c b/fs/dlm/lowcomms.c index 4813d0e0cd9b..cd9305b17ad5 100644 --- a/fs/dlm/lowcomms.c +++ b/fs/dlm/lowcomms.c @@ -758,13 +758,12 @@ static int tcp_accept_from_sock(struct connection *con) /* Get the new node's NODEID */ make_sockaddr(&peeraddr, 0, &len); if (addr_to_nodeid(&peeraddr, &nodeid)) { - unsigned char *b=(unsigned char *)&peeraddr; + unsigned char *b = (unsigned char *)&peeraddr; log_print("connect from non cluster node"); print_hex_dump_bytes("ss: ", DUMP_PREFIX_NONE, b, sizeof(struct sockaddr_storage)); - sock_release(newsock); - mutex_unlock(&con->sock_mutex); - return -1; + result = -1; + goto accept_err; } log_print("got connection from %d", nodeid); -- 2.11.0 -- To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html