All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kalle Valo <kvalo@qca.qualcomm.com>
To: <ath10k@lists.infradead.org>
Cc: <linux-wireless@vger.kernel.org>
Subject: [PATCH v4 1/8] ath10k: clean up error handling in ath10k_core_probe_fw()
Date: Wed, 3 Dec 2014 10:09:31 +0200	[thread overview]
Message-ID: <20141203080931.31187.15394.stgit@potku.adurom.net> (raw)
In-Reply-To: <20141203080803.31187.85059.stgit@potku.adurom.net>

Use the error handling style preferred in ath10k. Makes it easier to add
ath10k_init_firmware_features() function in the next patch.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
---
 drivers/net/wireless/ath/ath10k/core.c |   24 ++++++++++++++----------
 1 file changed, 14 insertions(+), 10 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/core.c b/drivers/net/wireless/ath/ath10k/core.c
index 7762061a1944..09784c68339b 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -1025,8 +1025,7 @@ static int ath10k_core_probe_fw(struct ath10k *ar)
 	ret = ath10k_bmi_get_target_info(ar, &target_info);
 	if (ret) {
 		ath10k_err(ar, "could not get target info (%d)\n", ret);
-		ath10k_hif_power_down(ar);
-		return ret;
+		goto err_power_down;
 	}
 
 	ar->target_version = target_info.version;
@@ -1035,15 +1034,13 @@ static int ath10k_core_probe_fw(struct ath10k *ar)
 	ret = ath10k_init_hw_params(ar);
 	if (ret) {
 		ath10k_err(ar, "could not get hw params (%d)\n", ret);
-		ath10k_hif_power_down(ar);
-		return ret;
+		goto err_power_down;
 	}
 
 	ret = ath10k_core_fetch_firmware_files(ar);
 	if (ret) {
 		ath10k_err(ar, "could not fetch firmware files (%d)\n", ret);
-		ath10k_hif_power_down(ar);
-		return ret;
+		goto err_power_down;
 	}
 
 	ath10k_core_init_max_sta_count(ar);
@@ -1053,10 +1050,7 @@ static int ath10k_core_probe_fw(struct ath10k *ar)
 	ret = ath10k_core_start(ar, ATH10K_FIRMWARE_MODE_NORMAL);
 	if (ret) {
 		ath10k_err(ar, "could not init core (%d)\n", ret);
-		ath10k_core_free_firmware_files(ar);
-		ath10k_hif_power_down(ar);
-		mutex_unlock(&ar->conf_mutex);
-		return ret;
+		goto err_unlock;
 	}
 
 	ath10k_print_driver_info(ar);
@@ -1066,6 +1060,16 @@ static int ath10k_core_probe_fw(struct ath10k *ar)
 
 	ath10k_hif_power_down(ar);
 	return 0;
+
+err_unlock:
+	mutex_unlock(&ar->conf_mutex);
+
+	ath10k_core_free_firmware_files(ar);
+
+err_power_down:
+	ath10k_hif_power_down(ar);
+
+	return ret;
 }
 
 static int ath10k_core_check_chip_id(struct ath10k *ar)


WARNING: multiple messages have this Message-ID (diff)
From: Kalle Valo <kvalo@qca.qualcomm.com>
To: ath10k@lists.infradead.org
Cc: linux-wireless@vger.kernel.org
Subject: [PATCH v4 1/8] ath10k: clean up error handling in ath10k_core_probe_fw()
Date: Wed, 3 Dec 2014 10:09:31 +0200	[thread overview]
Message-ID: <20141203080931.31187.15394.stgit@potku.adurom.net> (raw)
In-Reply-To: <20141203080803.31187.85059.stgit@potku.adurom.net>

Use the error handling style preferred in ath10k. Makes it easier to add
ath10k_init_firmware_features() function in the next patch.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
---
 drivers/net/wireless/ath/ath10k/core.c |   24 ++++++++++++++----------
 1 file changed, 14 insertions(+), 10 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/core.c b/drivers/net/wireless/ath/ath10k/core.c
index 7762061a1944..09784c68339b 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -1025,8 +1025,7 @@ static int ath10k_core_probe_fw(struct ath10k *ar)
 	ret = ath10k_bmi_get_target_info(ar, &target_info);
 	if (ret) {
 		ath10k_err(ar, "could not get target info (%d)\n", ret);
-		ath10k_hif_power_down(ar);
-		return ret;
+		goto err_power_down;
 	}
 
 	ar->target_version = target_info.version;
@@ -1035,15 +1034,13 @@ static int ath10k_core_probe_fw(struct ath10k *ar)
 	ret = ath10k_init_hw_params(ar);
 	if (ret) {
 		ath10k_err(ar, "could not get hw params (%d)\n", ret);
-		ath10k_hif_power_down(ar);
-		return ret;
+		goto err_power_down;
 	}
 
 	ret = ath10k_core_fetch_firmware_files(ar);
 	if (ret) {
 		ath10k_err(ar, "could not fetch firmware files (%d)\n", ret);
-		ath10k_hif_power_down(ar);
-		return ret;
+		goto err_power_down;
 	}
 
 	ath10k_core_init_max_sta_count(ar);
@@ -1053,10 +1050,7 @@ static int ath10k_core_probe_fw(struct ath10k *ar)
 	ret = ath10k_core_start(ar, ATH10K_FIRMWARE_MODE_NORMAL);
 	if (ret) {
 		ath10k_err(ar, "could not init core (%d)\n", ret);
-		ath10k_core_free_firmware_files(ar);
-		ath10k_hif_power_down(ar);
-		mutex_unlock(&ar->conf_mutex);
-		return ret;
+		goto err_unlock;
 	}
 
 	ath10k_print_driver_info(ar);
@@ -1066,6 +1060,16 @@ static int ath10k_core_probe_fw(struct ath10k *ar)
 
 	ath10k_hif_power_down(ar);
 	return 0;
+
+err_unlock:
+	mutex_unlock(&ar->conf_mutex);
+
+	ath10k_core_free_firmware_files(ar);
+
+err_power_down:
+	ath10k_hif_power_down(ar);
+
+	return ret;
 }
 
 static int ath10k_core_check_chip_id(struct ath10k *ar)


_______________________________________________
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k

  reply	other threads:[~2014-12-03  8:09 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-03  8:09 [PATCH v4 0/8] ath10k: add support for new wmi-tlv backend Kalle Valo
2014-12-03  8:09 ` Kalle Valo
2014-12-03  8:09 ` Kalle Valo [this message]
2014-12-03  8:09   ` [PATCH v4 1/8] ath10k: clean up error handling in ath10k_core_probe_fw() Kalle Valo
2014-12-03  8:09 ` [PATCH v4 2/8] ath10k: create ath10k_core_init_features() Kalle Valo
2014-12-03  8:09   ` Kalle Valo
2014-12-03  8:10 ` [PATCH v4 3/8] ath10k: add ATH10K_FW_IE_WMI_OP_VERSION Kalle Valo
2014-12-03  8:10   ` Kalle Valo
2014-12-03  8:10 ` [PATCH v4 4/8] ath10k: set max_num_pending_tx in ath10k_core_init_firmware_features() Kalle Valo
2014-12-03  8:10   ` Kalle Valo
2014-12-03  8:10 ` [PATCH v4 5/8] ath10k: implement intermediate event args Kalle Valo
2014-12-03  8:10   ` Kalle Valo
2014-12-03  8:10 ` [PATCH v4 6/8] ath10k: introduce wmi ops Kalle Valo
2014-12-03  8:10   ` Kalle Valo
2014-12-03 12:59   ` Michal Kazior
2014-12-03 12:59     ` Michal Kazior
2014-12-08  6:58     ` Kalle Valo
2014-12-08  6:58       ` Kalle Valo
2014-12-08  6:51   ` Michal Kazior
2014-12-08  6:51     ` Michal Kazior
2014-12-08  7:03     ` Kalle Valo
2014-12-08  7:03       ` Kalle Valo
2014-12-03  8:11 ` [PATCH v4 7/8] ath10k: make some wmi functions public Kalle Valo
2014-12-03  8:11   ` Kalle Valo
2014-12-03  8:11 ` [PATCH v4 8/8] ath10k: implement wmi-tlv backend Kalle Valo
2014-12-03  8:11   ` Kalle Valo
2014-12-03 13:01   ` Michal Kazior
2014-12-03 13:01     ` Michal Kazior
2014-12-08  6:54     ` Kalle Valo
2014-12-08  6:54       ` Kalle Valo
2014-12-08 15:41 ` [PATCH v4 0/8] ath10k: add support for new " Kalle Valo
2014-12-08 15:41   ` 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=20141203080931.31187.15394.stgit@potku.adurom.net \
    --to=kvalo@qca.qualcomm.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.