]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
ath10k: harmonize error case handling in ath10k_core_start
authorNicholas Mc Guire <hofrat@osadl.org>
Mon, 30 Mar 2015 12:39:21 +0000 (15:39 +0300)
committerKalle Valo <kvalo@qca.qualcomm.com>
Wed, 1 Apr 2015 17:19:07 +0000 (20:19 +0300)
All of the bringup/init functions called in ath10k_core_start return 0
on success and != 0 on failure. ath10k_wmi_wait_for_service_ready(),
ath10k_wmi_wait_for_unified_ready() and their call sites were adjusted
to fit this model.
The return type of wait_for_completion_timeout is unsigned long not int so
ath10k_wmi_wait_for_service_ready() and ath10k_wmi_wait_for_unified_ready()
were fixed up accordingly.

Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
drivers/net/wireless/ath/ath10k/core.c
drivers/net/wireless/ath/ath10k/wmi.c

index c826ec045a365dcf633d7ea9e111c909ac8d300f..1961e42f715769bd9852cb10312ce0abf0d1e078 100644 (file)
@@ -1123,9 +1123,8 @@ int ath10k_core_start(struct ath10k *ar, enum ath10k_firmware_mode mode)
 
        if (mode == ATH10K_FIRMWARE_MODE_NORMAL) {
                status = ath10k_wmi_wait_for_service_ready(ar);
-               if (status <= 0) {
+               if (status) {
                        ath10k_warn(ar, "wmi service ready event not received");
-                       status = -ETIMEDOUT;
                        goto err_hif_stop;
                }
        }
@@ -1141,9 +1140,8 @@ int ath10k_core_start(struct ath10k *ar, enum ath10k_firmware_mode mode)
        }
 
        status = ath10k_wmi_wait_for_unified_ready(ar);
-       if (status <= 0) {
+       if (status) {
                ath10k_err(ar, "wmi unified ready event not received\n");
-               status = -ETIMEDOUT;
                goto err_hif_stop;
        }
 
index 4778031b8635787f7eda33a6b67d31447afef0f3..1f47636f204b7bfc4e7a974823b396c1b4585ec2 100644 (file)
@@ -885,20 +885,24 @@ void ath10k_wmi_put_wmi_channel(struct wmi_channel *ch,
 
 int ath10k_wmi_wait_for_service_ready(struct ath10k *ar)
 {
-       int ret;
+       unsigned long time_left;
 
-       ret = wait_for_completion_timeout(&ar->wmi.service_ready,
-                                         WMI_SERVICE_READY_TIMEOUT_HZ);
-       return ret;
+       time_left = wait_for_completion_timeout(&ar->wmi.service_ready,
+                                               WMI_SERVICE_READY_TIMEOUT_HZ);
+       if (!time_left)
+               return -ETIMEDOUT;
+       return 0;
 }
 
 int ath10k_wmi_wait_for_unified_ready(struct ath10k *ar)
 {
-       int ret;
+       unsigned long time_left;
 
-       ret = wait_for_completion_timeout(&ar->wmi.unified_ready,
-                                         WMI_UNIFIED_READY_TIMEOUT_HZ);
-       return ret;
+       time_left = wait_for_completion_timeout(&ar->wmi.unified_ready,
+                                               WMI_UNIFIED_READY_TIMEOUT_HZ);
+       if (!time_left)
+               return -ETIMEDOUT;
+       return 0;
 }
 
 struct sk_buff *ath10k_wmi_alloc_skb(struct ath10k *ar, u32 len)