From 547e449f9855a9f91b312784487c332afbeedb87 Mon Sep 17 00:00:00 2001 From: Michael Scott Date: Thu, 13 Sep 2018 08:34:38 -0700 Subject: [PATCH] net: lwm2m: remove extra ref/unref in retransmit During the retransmit cycle we take ref on the outgoing packet, only to immediately unref it. Originally, this was to make sure the net_context handling didn't get rid of the packet when sendto() is called. But after checking, the ref counter is never in danger of going to 0 at this point in the code, so the added ref handling is useless. Signed-off-by: Michael Scott --- subsys/net/lib/lwm2m/lwm2m_engine.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/subsys/net/lib/lwm2m/lwm2m_engine.c b/subsys/net/lib/lwm2m/lwm2m_engine.c index a768bd9434a..2429e9a62c4 100644 --- a/subsys/net/lib/lwm2m/lwm2m_engine.c +++ b/subsys/net/lib/lwm2m/lwm2m_engine.c @@ -3634,9 +3634,6 @@ static void retransmit_request(struct k_work *work) return; } - /* ref pkt to avoid being freed after net_app_send_pkt() */ - net_pkt_ref(pending->pkt); - LOG_DBG("Resending message: %p", msg); msg->send_attempts++; /* @@ -3669,8 +3666,6 @@ static void retransmit_request(struct k_work *work) return; } - /* unref to balance ref we made for sendto() */ - net_pkt_unref(pending->pkt); k_delayed_work_submit(&client_ctx->retransmit_work, pending->timeout); }