From fe30ea50e7b76768a7dfa63e16120179b3b0985d Mon Sep 17 00:00:00 2001 From: Yu Ouyang Date: Wed, 10 Jun 2020 21:05:42 +0800 Subject: [PATCH] qcacld-3.0: Fix error handling of the vdev destroy timeout When vdev destroy event timeout, function wait_for_completion_timeout() will return zero. Zero means completion event timeout. But our code uses last status to check timeout or not timeout. SME will not be clean at this case. So, correct code to ensure sme can be clean. Change-Id: I4c0366a9d0f89d374f0e6aa50e0aa32f67fac03e CRs-Fixed: 2705855 --- core/hdd/src/wlan_hdd_main.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c index 4e7141ad9ae9..9269b0d7b1da 100644 --- a/core/hdd/src/wlan_hdd_main.c +++ b/core/hdd/src/wlan_hdd_main.c @@ -5037,13 +5037,10 @@ int hdd_vdev_destroy(struct hdd_adapter *adapter) rc = wait_for_completion_timeout( &adapter->vdev_destroy_event, msecs_to_jiffies(SME_CMD_VDEV_CREATE_DELETE_TIMEOUT)); - if (rc) { + if (!rc) { + hdd_err("timed out waiting for sme vdev delete"); clear_bit(SME_SESSION_OPENED, &adapter->event_flags); - - if (status == QDF_STATUS_E_TIMEOUT) { - hdd_err("timed out waiting for sme vdev delete"); - sme_cleanup_session(hdd_ctx->mac_handle, vdev_id); - } + sme_cleanup_session(hdd_ctx->mac_handle, vdev_id); } hdd_nofl_debug("vdev %d destroyed successfully", vdev_id);