diff mbox series

[09/11] wifi: iwlwifi: mei: use wait_event_timeout() return value

Message ID 20221102165239.33159054626f.Ief9e2dc42f96f8044c197d32172003a5ead0f8d3@changeid
State New
Headers show
Series iwlwifi: updates intended for v6.2 2022-11-02 | expand

Commit Message

Greenman, Gregory Nov. 2, 2022, 2:59 p.m. UTC
From: Avraham Stern <avraham.stern@intel.com>

wait_event_timeout() return value indicates whether the condition
evaluated to true or not, so no need to re-take the lock and
check the got_ownership flag.

Signed-off-by: Avraham Stern <avraham.stern@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
---
 drivers/net/wireless/intel/iwlwifi/mei/main.c | 21 +------------------
 1 file changed, 1 insertion(+), 20 deletions(-)
diff mbox series

Patch

diff --git a/drivers/net/wireless/intel/iwlwifi/mei/main.c b/drivers/net/wireless/intel/iwlwifi/mei/main.c
index a467da8b2aed..ef5d2938deb5 100644
--- a/drivers/net/wireless/intel/iwlwifi/mei/main.c
+++ b/drivers/net/wireless/intel/iwlwifi/mei/main.c
@@ -1447,26 +1447,7 @@  int iwl_mei_get_ownership(void)
 
 	ret = wait_event_timeout(mei->get_ownership_wq,
 				 mei->got_ownership, HZ / 2);
-	if (!ret)
-		return -ETIMEDOUT;
-
-	mutex_lock(&iwl_mei_mutex);
-
-	/* In case we didn't have a bind */
-	if (!iwl_mei_is_connected()) {
-		ret = 0;
-		goto out;
-	}
-
-	mei = mei_cldev_get_drvdata(iwl_mei_global_cldev);
-
-	if (!mei) {
-		ret = -ENODEV;
-		goto out;
-	}
-
-	ret = !mei->got_ownership;
-
+	return (!ret) ? -ETIMEDOUT : 0;
 out:
 	mutex_unlock(&iwl_mei_mutex);
 	return ret;