Skip to content

Commit a95ae67

Browse files
jukkarMaureenHelm
authored andcommitted
net: tcp2: Access k_work in k_delayed_work using field name
Instead of casting k_delayed_work directly to k_work, use the k_work field name. This avoids warnings from Coverity and allows the code to work even if the k_delayed_work fields are re-ordered in the future. Coverity-CID: 214346 Fixes #28659 Signed-off-by: Jukka Rissanen <[email protected]>
1 parent 74be161 commit a95ae67

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

subsys/net/ip/tcp2.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -698,7 +698,7 @@ static int tcp_out_ext(struct tcp *conn, uint8_t flags, struct net_pkt *data,
698698

699699
sys_slist_append(&conn->send_queue, &pkt->next);
700700

701-
tcp_send_process((struct k_work *)&conn->send_timer);
701+
tcp_send_process(&conn->send_timer.work);
702702
out:
703703
return ret;
704704
}
@@ -1517,8 +1517,7 @@ int net_tcp_queue_data(struct net_context *context, struct net_pkt *pkt)
15171517
/* Trigger resend if the timer is not active */
15181518
if (!k_delayed_work_remaining_get(&conn->send_data_timer)) {
15191519
NET_DBG("Window full, trigger resend");
1520-
tcp_resend_data(
1521-
(struct k_work *)&conn->send_data_timer);
1520+
tcp_resend_data(&conn->send_data_timer.work);
15221521
}
15231522

15241523
ret = -EAGAIN;

0 commit comments

Comments
 (0)