From 9bd8152057ba9f0376fdd2ad28ad13bc543c00ae Mon Sep 17 00:00:00 2001 From: Alok Kumar Date: Wed, 30 May 2018 13:07:13 +0530 Subject: [PATCH] qcacmn: Flush TxLookupQueue for ENDPOINT_0 during htc_cleanup When driver unload is triggered, check_for_leaks complains, saying it finds pending entries in TxLookupQueue of ENDPOINT_0. Flush pending entries in TxLookupQueue for ENDPOINT_0 during htc_cleanup. Change-Id: Ica661453d5cef283526cfa1e7267d5349b5e2310 CRs-Fixed: 2249980 --- htc/htc.c | 2 ++ htc/htc_internal.h | 3 +++ htc/htc_send.c | 22 ++++++++++++++++++++++ 3 files changed, 27 insertions(+) diff --git a/htc/htc.c b/htc/htc.c index 201c818495..17080cdd88 100644 --- a/htc/htc.c +++ b/htc/htc.c @@ -187,6 +187,8 @@ static void htc_cleanup(HTC_TARGET *target) } #endif + htc_flush_endpoint_txlookupQ(target, ENDPOINT_0); + qdf_spinlock_destroy(&target->HTCLock); qdf_spinlock_destroy(&target->HTCRxLock); qdf_spinlock_destroy(&target->HTCTxLock); diff --git a/htc/htc_internal.h b/htc/htc_internal.h index 068777e205..cdd387a529 100644 --- a/htc/htc_internal.h +++ b/htc/htc_internal.h @@ -296,6 +296,9 @@ void free_htc_packet_container(HTC_TARGET *target, HTC_PACKET *pPacket); void htc_flush_rx_hold_queue(HTC_TARGET *target, HTC_ENDPOINT *pEndpoint); void htc_flush_endpoint_tx(HTC_TARGET *target, HTC_ENDPOINT *pEndpoint, HTC_TX_TAG Tag); +void htc_flush_endpoint_txlookupQ(HTC_TARGET *target, + HTC_ENDPOINT_ID endpoint_id); + void htc_recv_init(HTC_TARGET *target); QDF_STATUS htc_wait_recv_ctrl_message(HTC_TARGET *target); void htc_free_control_tx_packet(HTC_TARGET *target, HTC_PACKET *pPacket); diff --git a/htc/htc_send.c b/htc/htc_send.c index 75d5f2f59a..c58b37c109 100644 --- a/htc/htc_send.c +++ b/htc/htc_send.c @@ -2058,6 +2058,28 @@ void htc_flush_endpoint_tx(HTC_TARGET *target, HTC_ENDPOINT *pEndpoint, UNLOCK_HTC_TX(target); } +/* flush pending entries in endpoint TX Lookup queue */ +void htc_flush_endpoint_txlookupQ(HTC_TARGET *target, + HTC_ENDPOINT_ID endpoint_id) +{ + HTC_PACKET *packet; + HTC_ENDPOINT *endpoint; + + endpoint = &target->endpoint[endpoint_id]; + + if (!endpoint && endpoint->service_id == 0) + return; + + while (HTC_PACKET_QUEUE_DEPTH(&endpoint->TxLookupQueue)) { + packet = htc_packet_dequeue(&endpoint->TxLookupQueue); + + if (packet) { + packet->Status = QDF_STATUS_E_CANCELED; + send_packet_completion(target, packet); + } + } +} + /* HTC API to flush an endpoint's TX queue*/ void htc_flush_endpoint(HTC_HANDLE HTCHandle, HTC_ENDPOINT_ID Endpoint, HTC_TX_TAG Tag)