mirror of
https://github.com/apache/nuttx.git
synced 2026-05-26 02:36:11 +08:00
net/can/can_recvmsg.c: Cleanup can_readahead
Build Documentation / build-html (push) Has been cancelled
Build Documentation / build-html (push) Has been cancelled
It is better to remove the iob from the readahead queue first, and only after that work on the iob. Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
This commit is contained in:
committed by
Xiang Xiao
parent
144ac23647
commit
f4142626b9
+4
-24
@@ -243,8 +243,8 @@ static inline int can_readahead(struct can_recvfrom_s *pstate)
|
||||
|
||||
pstate->pr_recvlen = -1;
|
||||
|
||||
if ((iob = iob_peek_queue(&conn->readahead)) != NULL &&
|
||||
pstate->pr_buflen > 0)
|
||||
if (pstate->pr_buflen > 0 &&
|
||||
(iob = iob_remove_queue(&conn->readahead)) != NULL)
|
||||
{
|
||||
DEBUGASSERT(iob->io_pktlen > 0);
|
||||
|
||||
@@ -256,17 +256,7 @@ static inline int can_readahead(struct can_recvfrom_s *pstate)
|
||||
|
||||
if (can_recv_filter(conn, can_id) == 0)
|
||||
{
|
||||
FAR struct iob_s *tmp;
|
||||
|
||||
/* Remove the I/O buffer chain from the head of the read-ahead
|
||||
* buffer queue.
|
||||
*/
|
||||
|
||||
tmp = iob_remove_queue(&conn->readahead);
|
||||
DEBUGASSERT(tmp == iob);
|
||||
UNUSED(tmp);
|
||||
|
||||
/* And free the I/O buffer chain */
|
||||
/* Free the I/O buffer chain */
|
||||
|
||||
iob_free_chain(iob);
|
||||
return 0;
|
||||
@@ -295,17 +285,7 @@ static inline int can_readahead(struct can_recvfrom_s *pstate)
|
||||
|
||||
static_assert(sizeof(struct can_frame) <= CONFIG_IOB_BUFSIZE);
|
||||
|
||||
FAR struct iob_s *tmp;
|
||||
|
||||
/* Remove the I/O buffer chain from the head of the read-ahead
|
||||
* buffer queue.
|
||||
*/
|
||||
|
||||
tmp = iob_remove_queue(&conn->readahead);
|
||||
DEBUGASSERT(tmp == iob);
|
||||
UNUSED(tmp);
|
||||
|
||||
/* And free the I/O buffer chain */
|
||||
/* Free the I/O buffer chain */
|
||||
|
||||
iob_free_chain(iob);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user