From: mpi Date: Tue, 19 Dec 2017 09:29:37 +0000 (+0000) Subject: Remove unnecessary unlock/lock dance when following a goto. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=5212234a89584c010d28cef339620441e19982cc;p=openbsd Remove unnecessary unlock/lock dance when following a goto. ok bluhm@ --- diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c index 3e4423be70f..64c0c65ca93 100644 --- a/sys/kern/uipc_socket.c +++ b/sys/kern/uipc_socket.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uipc_socket.c,v 1.211 2017/12/18 10:07:55 mpi Exp $ */ +/* $OpenBSD: uipc_socket.c,v 1.212 2017/12/19 09:29:37 mpi Exp $ */ /* $NetBSD: uipc_socket.c,v 1.21 1996/02/04 02:17:52 christos Exp $ */ /* @@ -668,8 +668,8 @@ bad: if (mp) *mp = NULL; -restart: s = solock(so); +restart: if ((error = sblock(so, &so->so_rcv, SBLOCKWAIT(flags))) != 0) { sounlock(s); return (error); @@ -738,9 +738,10 @@ restart: SBLASTMBUFCHK(&so->so_rcv, "soreceive sbwait 1"); sbunlock(so, &so->so_rcv); error = sbwait(so, &so->so_rcv); - sounlock(s); - if (error) + if (error) { + sounlock(s); return (error); + } goto restart; } dontblock: @@ -994,7 +995,6 @@ dontblock: if (orig_resid == uio->uio_resid && orig_resid && (flags & MSG_EOR) == 0 && (so->so_state & SS_CANTRCVMORE) == 0) { sbunlock(so, &so->so_rcv); - sounlock(s); goto restart; }