linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michal Kazior <michal.kazior@tieto.com>
To: ath10k@lists.infradead.org
Cc: linux-wireless@vger.kernel.org, Michal Kazior <michal.kazior@tieto.com>
Subject: [PATCH v2 1/5] ath10k: clean up start() callback
Date: Thu, 15 May 2014 10:42:00 +0200	[thread overview]
Message-ID: <1400143324-14911-2-git-send-email-michal.kazior@tieto.com> (raw)
In-Reply-To: <1400143324-14911-1-git-send-email-michal.kazior@tieto.com>

This fixes failpath when override AC pdev param
setup fails and makes other pdev params setting
fail as well.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
---
v2:
 * add empty lines before each goto label [Kalle]
 * dont use err goto paths on main code path [Kalle]

 drivers/net/wireless/ath/ath10k/mac.c | 34 +++++++++++++++++++++++-----------
 1 file changed, 23 insertions(+), 11 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c
index 7026f02..854e183 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -2339,22 +2339,19 @@ static int ath10k_start(struct ieee80211_hw *hw)
 	if (ar->state != ATH10K_STATE_OFF &&
 	    ar->state != ATH10K_STATE_RESTARTING) {
 		ret = -EINVAL;
-		goto exit;
+		goto err;
 	}
 
 	ret = ath10k_hif_power_up(ar);
 	if (ret) {
 		ath10k_err("Could not init hif: %d\n", ret);
-		ar->state = ATH10K_STATE_OFF;
-		goto exit;
+		goto err_off;
 	}
 
 	ret = ath10k_core_start(ar);
 	if (ret) {
 		ath10k_err("Could not init core: %d\n", ret);
-		ath10k_hif_power_down(ar);
-		ar->state = ATH10K_STATE_OFF;
-		goto exit;
+		goto err_power_down;
 	}
 
 	if (ar->state == ATH10K_STATE_OFF)
@@ -2363,12 +2360,16 @@ static int ath10k_start(struct ieee80211_hw *hw)
 		ar->state = ATH10K_STATE_RESTARTED;
 
 	ret = ath10k_wmi_pdev_set_param(ar, ar->wmi.pdev_param->pmf_qos, 1);
-	if (ret)
+	if (ret) {
 		ath10k_warn("failed to enable PMF QOS: %d\n", ret);
+		goto err_core_stop;
+	}
 
 	ret = ath10k_wmi_pdev_set_param(ar, ar->wmi.pdev_param->dynamic_bw, 1);
-	if (ret)
+	if (ret) {
 		ath10k_warn("failed to enable dynamic BW: %d\n", ret);
+		goto err_core_stop;
+	}
 
 	/*
 	 * By default FW set ARP frames ac to voice (6). In that case ARP
@@ -2384,14 +2385,25 @@ static int ath10k_start(struct ieee80211_hw *hw)
 	if (ret) {
 		ath10k_warn("failed to set arp ac override parameter: %d\n",
 			    ret);
-		goto exit;
+		goto err_core_stop;
 	}
 
 	ar->num_started_vdevs = 0;
 	ath10k_regd_update(ar);
-	ret = 0;
 
-exit:
+	mutex_unlock(&ar->conf_mutex);
+	return 0;
+
+err_core_stop:
+	ath10k_core_stop(ar);
+
+err_power_down:
+	ath10k_hif_power_down(ar);
+
+err_off:
+	ar->state = ATH10K_STATE_OFF;
+
+err:
 	mutex_unlock(&ar->conf_mutex);
 	return ret;
 }
-- 
1.8.5.3


  reply	other threads:[~2014-05-15  8:49 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-09 12:15 [PATCH 0/5] ath10k: recovery fixes 2014-05-09 Michal Kazior
2014-05-09 12:15 ` [PATCH 1/5] ath10k: clean up start() callback Michal Kazior
2014-05-14 19:07   ` Kalle Valo
2014-05-09 12:15 ` [PATCH 2/5] ath10k: perform hw restart lazily Michal Kazior
2014-05-09 12:15 ` [PATCH 3/5] ath10k: drain tx before restarting hw Michal Kazior
2014-05-09 12:15 ` [PATCH 4/5] ath10k: protect wep tx key setup Michal Kazior
2014-05-14 19:17   ` Kalle Valo
2014-05-14 19:50   ` Kalle Valo
2014-05-15  6:04     ` Michal Kazior
2014-05-09 12:15 ` [PATCH 5/5] ath10k: dont configure bssid for ap mode Michal Kazior
2014-05-14 18:58   ` Kalle Valo
2014-05-15  8:41 ` [PATCH v2 0/5] ath10k: recovery fixes 2014-05-09 Michal Kazior
2014-05-15  8:42   ` Michal Kazior [this message]
2014-05-15  8:42   ` [PATCH v2 2/5] ath10k: perform hw restart lazily Michal Kazior
2014-05-15  8:42   ` [PATCH v2 3/5] ath10k: drain tx before restarting hw Michal Kazior
2014-05-15 13:18     ` Kalle Valo
2014-05-16 14:37       ` Kalle Valo
2014-05-23  8:27     ` Kalle Valo
2014-05-23  8:38       ` Michal Kazior
2014-05-23  8:45         ` Kalle Valo
2014-05-23  9:06           ` Michal Kazior
2014-05-23 10:31             ` Kalle Valo
2014-05-23 10:37               ` Michal Kazior
2014-05-23 13:03             ` Johannes Berg
2014-05-26  5:48               ` Michal Kazior
2014-05-26  6:29                 ` Johannes Berg
2014-05-26  9:40     ` Kalle Valo
2014-05-26  9:43       ` Michal Kazior
2014-05-15  8:42   ` [PATCH v2 4/5] ath10k: protect wep tx key setup Michal Kazior
2014-05-15  8:42   ` [PATCH v2 5/5] ath10k: dont configure bssid for ap mode Michal Kazior
2014-05-27  9:29   ` [PATCH v2 0/5] ath10k: recovery fixes 2014-05-09 Kalle Valo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1400143324-14911-2-git-send-email-michal.kazior@tieto.com \
    --to=michal.kazior@tieto.com \
    --cc=ath10k@lists.infradead.org \
    --cc=linux-wireless@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).