]> Pileus Git - ~andy/linux/blobdiff - drivers/net/wireless/ath/ath10k/htc.c
Merge tag 'for-linville-20131203' of git://github.com/kvalo/ath
[~andy/linux] / drivers / net / wireless / ath / ath10k / htc.c
index edae50b52806f5382fc6ee7296ac810fda2eb9b5..edc57ab505c893c3dd295d01a3f44fd2126e3dee 100644 (file)
@@ -191,6 +191,11 @@ static int ath10k_htc_tx_completion_handler(struct ath10k *ar,
        struct ath10k_htc *htc = &ar->htc;
        struct ath10k_htc_ep *ep = &htc->endpoint[eid];
 
+       if (!skb) {
+               ath10k_warn("invalid sk_buff completion - NULL pointer. firmware crashed?\n");
+               return 0;
+       }
+
        ath10k_htc_notify_tx_completion(ep, skb);
        /* the skb now belongs to the completion handler */
 
@@ -534,14 +539,6 @@ int ath10k_htc_wait_target(struct ath10k_htc *htc)
        u16 credit_count;
        u16 credit_size;
 
-       reinit_completion(&htc->ctl_resp);
-
-       status = ath10k_hif_start(htc->ar);
-       if (status) {
-               ath10k_err("could not start HIF (%d)\n", status);
-               goto err_start;
-       }
-
        status = wait_for_completion_timeout(&htc->ctl_resp,
                                             ATH10K_HTC_WAIT_TIMEOUT_HZ);
        if (status <= 0) {
@@ -549,15 +546,13 @@ int ath10k_htc_wait_target(struct ath10k_htc *htc)
                        status = -ETIMEDOUT;
 
                ath10k_err("ctl_resp never came in (%d)\n", status);
-               goto err_target;
+               return status;
        }
 
        if (htc->control_resp_len < sizeof(msg->hdr) + sizeof(msg->ready)) {
                ath10k_err("Invalid HTC ready msg len:%d\n",
                           htc->control_resp_len);
-
-               status = -ECOMM;
-               goto err_target;
+               return -ECOMM;
        }
 
        msg = (struct ath10k_htc_msg *)htc->control_resp_buffer;
@@ -567,8 +562,7 @@ int ath10k_htc_wait_target(struct ath10k_htc *htc)
 
        if (message_id != ATH10K_HTC_MSG_READY_ID) {
                ath10k_err("Invalid HTC ready msg: 0x%x\n", message_id);
-               status = -ECOMM;
-               goto err_target;
+               return -ECOMM;
        }
 
        htc->total_transmit_credits = credit_count;
@@ -581,9 +575,8 @@ int ath10k_htc_wait_target(struct ath10k_htc *htc)
 
        if ((htc->total_transmit_credits == 0) ||
            (htc->target_credit_size == 0)) {
-               status = -ECOMM;
                ath10k_err("Invalid credit size received\n");
-               goto err_target;
+               return -ECOMM;
        }
 
        ath10k_htc_setup_target_buffer_assignments(htc);
@@ -600,14 +593,10 @@ int ath10k_htc_wait_target(struct ath10k_htc *htc)
        status = ath10k_htc_connect_service(htc, &conn_req, &conn_resp);
        if (status) {
                ath10k_err("could not connect to htc service (%d)\n", status);
-               goto err_target;
+               return status;
        }
 
        return 0;
-err_target:
-       ath10k_hif_stop(htc->ar);
-err_start:
-       return status;
 }
 
 int ath10k_htc_connect_service(struct ath10k_htc *htc,