net/usrsock: Remove the unnecessary label

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao 2022-09-08 15:45:13 +08:00 committed by Masayuki Ishikawa
parent 3d0985df39
commit 3269c1a102

View File

@ -92,10 +92,10 @@ static ssize_t usrsock_iovec_do(FAR void *srcdst, size_t srcdstlen,
FAR struct iovec *iov, int iovcnt, FAR struct iovec *iov, int iovcnt,
size_t pos, bool from_iov) size_t pos, bool from_iov)
{ {
ssize_t total = 0;
size_t srclen = 0;
FAR uint8_t *ioout = srcdst; FAR uint8_t *ioout = srcdst;
FAR uint8_t *iovbuf; FAR uint8_t *iovbuf;
ssize_t total = 0;
size_t srclen = 0;
/* Rewind to correct position. */ /* Rewind to correct position. */
@ -117,8 +117,7 @@ static ssize_t usrsock_iovec_do(FAR void *srcdst, size_t srcdstlen,
{ {
/* Position beyond iovec. */ /* Position beyond iovec. */
total = -EINVAL; return -EINVAL;
goto out;
} }
iovbuf = iov->iov_base; iovbuf = iov->iov_base;
@ -178,7 +177,6 @@ static ssize_t usrsock_iovec_do(FAR void *srcdst, size_t srcdstlen,
} }
} }
out:
return total; return total;
} }
@ -291,21 +289,18 @@ usrsock_handle_datareq_response(FAR struct usrsock_conn_s *conn,
FAR struct usrsock_req_s *req = &g_usrsock_req; FAR struct usrsock_req_s *req = &g_usrsock_req;
int num_inbufs; int num_inbufs;
int iovpos; int iovpos;
ssize_t ret;
if (USRSOCK_MESSAGE_REQ_IN_PROGRESS(hdr->head.flags)) if (USRSOCK_MESSAGE_REQ_IN_PROGRESS(hdr->head.flags))
{ {
if (datahdr->reqack.result > 0) if (datahdr->reqack.result > 0)
{ {
ninfo("error: request in progress, and result > 0.\n"); ninfo("error: request in progress, and result > 0.\n");
ret = -EINVAL; return -EINVAL;
goto unlock_out;
} }
else if (datahdr->valuelen > 0) else if (datahdr->valuelen > 0)
{ {
ninfo("error: request in progress, and valuelen > 0.\n"); ninfo("error: request in progress, and valuelen > 0.\n");
ret = -EINVAL; return -EINVAL;
goto unlock_out;
} }
/* In-progress response is acknowledgment that response was /* In-progress response is acknowledgment that response was
@ -314,8 +309,7 @@ usrsock_handle_datareq_response(FAR struct usrsock_conn_s *conn,
conn->resp.inprogress = true; conn->resp.inprogress = true;
ret = sizeof(*datahdr); return sizeof(*datahdr);
goto unlock_out;
} }
conn->resp.inprogress = false; conn->resp.inprogress = false;
@ -336,16 +330,14 @@ usrsock_handle_datareq_response(FAR struct usrsock_conn_s *conn,
nerr("error: response result negative, and valuelen or " nerr("error: response result negative, and valuelen or "
"valuelen_nontrunc non-zero.\n"); "valuelen_nontrunc non-zero.\n");
ret = -EINVAL; return -EINVAL;
goto unlock_out;
} }
/* Done with request/response. */ /* Done with request/response. */
usrsock_event(conn); usrsock_event(conn);
ret = sizeof(*datahdr); return sizeof(*datahdr);
goto unlock_out;
} }
/* Check that number of buffers match available. */ /* Check that number of buffers match available. */
@ -357,8 +349,7 @@ usrsock_handle_datareq_response(FAR struct usrsock_conn_s *conn,
nwarn("not enough recv buffers (need: %d, have: %d).\n", num_inbufs, nwarn("not enough recv buffers (need: %d, have: %d).\n", num_inbufs,
conn->resp.datain.iovcnt); conn->resp.datain.iovcnt);
ret = -EINVAL; return -EINVAL;
goto unlock_out;
} }
/* Adjust length of receiving buffers. */ /* Adjust length of receiving buffers. */
@ -375,8 +366,7 @@ usrsock_handle_datareq_response(FAR struct usrsock_conn_s *conn,
datahdr->valuelen, datahdr->valuelen,
conn->resp.datain.iov[iovpos].iov_len); conn->resp.datain.iov[iovpos].iov_len);
ret = -EINVAL; return -EINVAL;
goto unlock_out;
} }
/* Adjust read size. */ /* Adjust read size. */
@ -397,8 +387,7 @@ usrsock_handle_datareq_response(FAR struct usrsock_conn_s *conn,
hdr->result, hdr->result,
conn->resp.datain.iov[iovpos].iov_len); conn->resp.datain.iov[iovpos].iov_len);
ret = -EINVAL; return -EINVAL;
goto unlock_out;
} }
/* Adjust read size. */ /* Adjust read size. */
@ -415,10 +404,7 @@ usrsock_handle_datareq_response(FAR struct usrsock_conn_s *conn,
/* Next written buffers are redirected to data buffers. */ /* Next written buffers are redirected to data buffers. */
req->datain_conn = conn; req->datain_conn = conn;
ret = sizeof(*datahdr); return sizeof(*datahdr);
unlock_out:
return ret;
} }
/**************************************************************************** /****************************************************************************
@ -552,8 +538,7 @@ ssize_t usrsock_response(FAR const char *buffer, size_t len,
nwarn("message too short, %zu < %zu.\n", len, nwarn("message too short, %zu < %zu.\n", len,
sizeof(struct usrsock_message_common_s)); sizeof(struct usrsock_message_common_s));
ret = -EINVAL; return -EINVAL;
goto errout;
} }
/* Handle message. */ /* Handle message. */
@ -604,7 +589,6 @@ ssize_t usrsock_response(FAR const char *buffer, size_t len,
} }
} }
errout:
return ret; return ret;
} }
@ -687,8 +671,8 @@ int usrsock_do_request(FAR struct usrsock_conn_s *conn,
void usrsock_abort(void) void usrsock_abort(void)
{ {
FAR struct usrsock_conn_s *conn = NULL;
FAR struct usrsock_req_s *req = &g_usrsock_req; FAR struct usrsock_req_s *req = &g_usrsock_req;
FAR struct usrsock_conn_s *conn = NULL;
int ret; int ret;
net_lock(); net_lock();