Skip to content

Commit c9f9d5c

Browse files
ndrs-psthenrikbrixandersen
authored andcommitted
net: tcp: remove redundant null check for conn in net_tcp_put()
A null check for the TCP connection `conn` was added at the start of the function, but the previous checks were not removed, leading to a redundant null check, which is unnecessary. Signed-off-by: Pisit Sawangvonganan <[email protected]>
1 parent 2eda5f3 commit c9f9d5c

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

subsys/net/ip/tcp.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3637,8 +3637,8 @@ int net_tcp_put(struct net_context *context)
36373637
({ const char *state = net_context_state(context);
36383638
state ? state : "<unknown>"; }));
36393639

3640-
if (conn && (conn->state == TCP_ESTABLISHED ||
3641-
conn->state == TCP_SYN_RECEIVED)) {
3640+
if (conn->state == TCP_ESTABLISHED ||
3641+
conn->state == TCP_SYN_RECEIVED) {
36423642
/* Send all remaining data if possible. */
36433643
if (conn->send_data_total > 0) {
36443644
NET_DBG("conn %p pending %zu bytes", conn,
@@ -3670,7 +3670,7 @@ int net_tcp_put(struct net_context *context)
36703670

36713671
keep_alive_timer_stop(conn);
36723672
}
3673-
} else if (conn && conn->in_connect) {
3673+
} else if (conn->in_connect) {
36743674
conn->in_connect = false;
36753675
k_sem_reset(&conn->connect_sem);
36763676
}

0 commit comments

Comments
 (0)