From eda409102e5f4d3e05fe9e65c4f384bcd5c6f07e Mon Sep 17 00:00:00 2001 From: wadesong Date: Thu, 14 Sep 2017 14:58:34 +0800 Subject: [PATCH] qcacld-3.0: Initialize some locks before they are used htt_tx_mutex, NBUF_QUEUE_MUTEX and HTT credit_mutex should all be initialized before the related message handlers are connected to their corresponding services, or there will be racing conditions happening during WLAN driver initialization which will cause the Linux kernel complaining for bad magic of spin locks and triggers watch dog bite. Change-Id: Id89185d811bcbed95732f142ed6fd611e0d6e2a4 CRs-Fixed: 2109674 --- core/dp/htt/htt.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/core/dp/htt/htt.c b/core/dp/htt/htt.c index 307095f579..0b5182fd39 100644 --- a/core/dp/htt/htt.c +++ b/core/dp/htt/htt.c @@ -430,6 +430,9 @@ htt_pdev_alloc(ol_txrx_pdev_handle txrx_pdev, * since htt_rx_attach involves sending a rx ring configure * message to the target. */ + HTT_TX_MUTEX_INIT(&pdev->htt_tx_mutex); + HTT_TX_NBUF_QUEUE_MUTEX_INIT(pdev); + HTT_TX_MUTEX_INIT(&pdev->credit_mutex); if (htt_htc_attach_all(pdev)) goto htt_htc_attach_fail; if (hif_ce_fastpath_cb_register(osc, htt_t2h_msg_handler_fast, pdev)) @@ -439,6 +442,9 @@ success: return pdev; htt_htc_attach_fail: + HTT_TX_MUTEX_DESTROY(&pdev->credit_mutex); + HTT_TX_MUTEX_DESTROY(&pdev->htt_tx_mutex); + HTT_TX_NBUF_QUEUE_MUTEX_DESTROY(pdev); qdf_mem_free(pdev); fail1: @@ -467,10 +473,6 @@ htt_attach(struct htt_pdev_t *pdev, int desc_pool_size) if (ret) goto fail2; - HTT_TX_MUTEX_INIT(&pdev->htt_tx_mutex); - HTT_TX_NBUF_QUEUE_MUTEX_INIT(pdev); - HTT_TX_MUTEX_INIT(&pdev->credit_mutex); - /* pre-allocate some HTC_PACKET objects */ for (i = 0; i < HTT_HTC_PKT_POOL_INIT_SIZE; i++) { struct htt_htc_pkt_union *pkt;