net/tcp: remove conn check since which can not be NULL

Signed-off-by: chao an <anchao@xiaomi.com>
This commit is contained in:
chao an 2023-02-02 11:41:58 +08:00 committed by Xiang Xiao
parent 4c8d244fae
commit 247b050e5f
2 changed files with 28 additions and 29 deletions

View File

@ -159,7 +159,7 @@ static uint16_t psock_connect_eventhandler(FAR struct net_driver_s *dev,
FAR void *pvpriv, uint16_t flags)
{
struct tcp_connect_s *pstate = pvpriv;
FAR struct tcp_conn_s *conn = pstate->tc_conn;
FAR struct tcp_conn_s *conn;
ninfo("flags: %04x\n", flags);
@ -167,6 +167,8 @@ static uint16_t psock_connect_eventhandler(FAR struct net_driver_s *dev,
if (pstate)
{
conn = pstate->tc_conn;
/* The following errors should be detected here (someday)
*
* ECONNREFUSED

View File

@ -273,8 +273,6 @@ static inline void psock_lost_connection(FAR struct tcp_conn_s *conn,
conn->sndcb->event = NULL;
}
if (conn != NULL)
{
/* Free all queued write buffers */
for (entry = sq_peek(&conn->unacked_q); entry; entry = next)
@ -314,7 +312,6 @@ static inline void psock_lost_connection(FAR struct tcp_conn_s *conn,
conn->tx_unacked = 0;
conn->tcpstateflags = TCP_CLOSED;
}
}
}
/****************************************************************************