aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichal Kazior <michal.kazior@tieto.com>2013-11-08 02:05:18 -0500
committerKalle Valo <kvalo@qca.qualcomm.com>2013-11-12 13:08:50 -0500
commit67e3c63fef6041f41e22335852de9d3924cff7a1 (patch)
treef91637a37ccac23d381d9ae3907a685598de97f3
parent6a42a47e23acdcbc97aac925b5a14d1b187606cf (diff)
ath10k: fix core init failpath
HIF was not stopped properly in ath10k_core_start() upon failure. This could cause memory leaks of CE completions entries and possibly other issues as well. Move the HIF start/stop out of ath10k_htc_wait_target(). The ctl_resp completion is already prepared in ath10k_htc_init. Signed-off-by: Michal Kazior <michal.kazior@tieto.com> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
-rw-r--r--drivers/net/wireless/ath/ath10k/core.c16
-rw-r--r--drivers/net/wireless/ath/ath10k/htc.c26
2 files changed, 18 insertions, 24 deletions
diff --git a/drivers/net/wireless/ath/ath10k/core.c b/drivers/net/wireless/ath/ath10k/core.c
index 7d8687694360..be5b17e89902 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -785,14 +785,22 @@ int ath10k_core_start(struct ath10k *ar)
785 goto err; 785 goto err;
786 } 786 }
787 787
788 status = ath10k_htc_wait_target(&ar->htc); 788 status = ath10k_hif_start(ar);
789 if (status) 789 if (status) {
790 ath10k_err("could not start HIF: %d\n", status);
790 goto err_wmi_detach; 791 goto err_wmi_detach;
792 }
793
794 status = ath10k_htc_wait_target(&ar->htc);
795 if (status) {
796 ath10k_err("failed to connect to HTC: %d\n", status);
797 goto err_hif_stop;
798 }
791 799
792 status = ath10k_htt_attach(ar); 800 status = ath10k_htt_attach(ar);
793 if (status) { 801 if (status) {
794 ath10k_err("could not attach htt (%d)\n", status); 802 ath10k_err("could not attach htt (%d)\n", status);
795 goto err_wmi_detach; 803 goto err_hif_stop;
796 } 804 }
797 805
798 status = ath10k_init_connect_htc(ar); 806 status = ath10k_init_connect_htc(ar);
@@ -831,6 +839,8 @@ err_disconnect_htc:
831 ath10k_htc_stop(&ar->htc); 839 ath10k_htc_stop(&ar->htc);
832err_htt_detach: 840err_htt_detach:
833 ath10k_htt_detach(&ar->htt); 841 ath10k_htt_detach(&ar->htt);
842err_hif_stop:
843 ath10k_hif_stop(ar);
834err_wmi_detach: 844err_wmi_detach:
835 ath10k_wmi_detach(ar); 845 ath10k_wmi_detach(ar);
836err: 846err:
diff --git a/drivers/net/wireless/ath/ath10k/htc.c b/drivers/net/wireless/ath/ath10k/htc.c
index 6d7a72eb11a5..b068ae04cf6b 100644
--- a/drivers/net/wireless/ath/ath10k/htc.c
+++ b/drivers/net/wireless/ath/ath10k/htc.c
@@ -539,14 +539,6 @@ int ath10k_htc_wait_target(struct ath10k_htc *htc)
539 u16 credit_count; 539 u16 credit_count;
540 u16 credit_size; 540 u16 credit_size;
541 541
542 INIT_COMPLETION(htc->ctl_resp);
543
544 status = ath10k_hif_start(htc->ar);
545 if (status) {
546 ath10k_err("could not start HIF (%d)\n", status);
547 goto err_start;
548 }
549
550 status = wait_for_completion_timeout(&htc->ctl_resp, 542 status = wait_for_completion_timeout(&htc->ctl_resp,
551 ATH10K_HTC_WAIT_TIMEOUT_HZ); 543 ATH10K_HTC_WAIT_TIMEOUT_HZ);
552 if (status <= 0) { 544 if (status <= 0) {
@@ -554,15 +546,13 @@ int ath10k_htc_wait_target(struct ath10k_htc *htc)
554 status = -ETIMEDOUT; 546 status = -ETIMEDOUT;
555 547
556 ath10k_err("ctl_resp never came in (%d)\n", status); 548 ath10k_err("ctl_resp never came in (%d)\n", status);
557 goto err_target; 549 return status;
558 } 550 }
559 551
560 if (htc->control_resp_len < sizeof(msg->hdr) + sizeof(msg->ready)) { 552 if (htc->control_resp_len < sizeof(msg->hdr) + sizeof(msg->ready)) {
561 ath10k_err("Invalid HTC ready msg len:%d\n", 553 ath10k_err("Invalid HTC ready msg len:%d\n",
562 htc->control_resp_len); 554 htc->control_resp_len);
563 555 return -ECOMM;
564 status = -ECOMM;
565 goto err_target;
566 } 556 }
567 557
568 msg = (struct ath10k_htc_msg *)htc->control_resp_buffer; 558 msg = (struct ath10k_htc_msg *)htc->control_resp_buffer;
@@ -572,8 +562,7 @@ int ath10k_htc_wait_target(struct ath10k_htc *htc)
572 562
573 if (message_id != ATH10K_HTC_MSG_READY_ID) { 563 if (message_id != ATH10K_HTC_MSG_READY_ID) {
574 ath10k_err("Invalid HTC ready msg: 0x%x\n", message_id); 564 ath10k_err("Invalid HTC ready msg: 0x%x\n", message_id);
575 status = -ECOMM; 565 return -ECOMM;
576 goto err_target;
577 } 566 }
578 567
579 htc->total_transmit_credits = credit_count; 568 htc->total_transmit_credits = credit_count;
@@ -586,9 +575,8 @@ int ath10k_htc_wait_target(struct ath10k_htc *htc)
586 575
587 if ((htc->total_transmit_credits == 0) || 576 if ((htc->total_transmit_credits == 0) ||
588 (htc->target_credit_size == 0)) { 577 (htc->target_credit_size == 0)) {
589 status = -ECOMM;
590 ath10k_err("Invalid credit size received\n"); 578 ath10k_err("Invalid credit size received\n");
591 goto err_target; 579 return -ECOMM;
592 } 580 }
593 581
594 ath10k_htc_setup_target_buffer_assignments(htc); 582 ath10k_htc_setup_target_buffer_assignments(htc);
@@ -605,14 +593,10 @@ int ath10k_htc_wait_target(struct ath10k_htc *htc)
605 status = ath10k_htc_connect_service(htc, &conn_req, &conn_resp); 593 status = ath10k_htc_connect_service(htc, &conn_req, &conn_resp);
606 if (status) { 594 if (status) {
607 ath10k_err("could not connect to htc service (%d)\n", status); 595 ath10k_err("could not connect to htc service (%d)\n", status);
608 goto err_target; 596 return status;
609 } 597 }
610 598
611 return 0; 599 return 0;
612err_target:
613 ath10k_hif_stop(htc->ar);
614err_start:
615 return status;
616} 600}
617 601
618int ath10k_htc_connect_service(struct ath10k_htc *htc, 602int ath10k_htc_connect_service(struct ath10k_htc *htc,