Linux-Wireless Archive mirror
 help / color / mirror / Atom feed
From: Jerome Pouiller <Jerome.Pouiller@silabs.com>
To: devel@driverdev.osuosl.org, linux-wireless@vger.kernel.org
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	"Kalle Valo" <kvalo@codeaurora.org>,
	"David S . Miller" <davem@davemloft.net>,
	"Jérôme Pouiller" <jerome.pouiller@silabs.com>
Subject: [PATCH 23/31] staging: wfx: use explicit labels for errors
Date: Thu, 13 Jan 2022 09:55:16 +0100	[thread overview]
Message-ID: <20220113085524.1110708-24-Jerome.Pouiller@silabs.com> (raw)
In-Reply-To: <20220113085524.1110708-1-Jerome.Pouiller@silabs.com>

From: Jérôme Pouiller <jerome.pouiller@silabs.com>

Prefer fully named labels to handle errors instead of err0, err1, ...

Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
---
 drivers/staging/wfx/bus_sdio.c |  9 ++++-----
 drivers/staging/wfx/main.c     | 31 +++++++++++++++----------------
 2 files changed, 19 insertions(+), 21 deletions(-)

diff --git a/drivers/staging/wfx/bus_sdio.c b/drivers/staging/wfx/bus_sdio.c
index 4b77df2f463e..5c45ccd85a7d 100644
--- a/drivers/staging/wfx/bus_sdio.c
+++ b/drivers/staging/wfx/bus_sdio.c
@@ -214,26 +214,25 @@ static int wfx_sdio_probe(struct sdio_func *func, const struct sdio_device_id *i
 	sdio_set_block_size(func, 64);
 	sdio_release_host(func);
 	if (ret)
-		goto err0;
+		return ret;
 
 	bus->core = wfx_init_common(&func->dev, &wfx_sdio_pdata,
 				    &wfx_sdio_hwbus_ops, bus);
 	if (!bus->core) {
 		ret = -EIO;
-		goto err1;
+		goto sdio_release;
 	}
 
 	ret = wfx_probe(bus->core);
 	if (ret)
-		goto err1;
+		goto sdio_release;
 
 	return 0;
 
-err1:
+sdio_release:
 	sdio_claim_host(func);
 	sdio_disable_func(func);
 	sdio_release_host(func);
-err0:
 	return ret;
 }
 
diff --git a/drivers/staging/wfx/main.c b/drivers/staging/wfx/main.c
index 217c0c5c60d1..46fd5702e471 100644
--- a/drivers/staging/wfx/main.c
+++ b/drivers/staging/wfx/main.c
@@ -232,18 +232,17 @@ static int wfx_send_pdata_pds(struct wfx_dev *wdev)
 	if (ret) {
 		dev_err(wdev->dev, "can't load antenna parameters (PDS file %s). The device may be unstable.\n",
 			wdev->pdata.file_pds);
-		goto err1;
+		return ret;
 	}
 	tmp_buf = kmemdup(pds->data, pds->size, GFP_KERNEL);
 	if (!tmp_buf) {
 		ret = -ENOMEM;
-		goto err2;
+		goto release_fw;
 	}
 	ret = wfx_send_pds(wdev, tmp_buf, pds->size);
 	kfree(tmp_buf);
-err2:
+release_fw:
 	release_firmware(pds);
-err1:
 	return ret;
 }
 
@@ -350,7 +349,7 @@ int wfx_probe(struct wfx_dev *wdev)
 
 	err = wfx_init_device(wdev);
 	if (err)
-		goto err0;
+		goto bh_unregister;
 
 	wfx_bh_poll_irq(wdev);
 	err = wait_for_completion_timeout(&wdev->firmware_ready, 1 * HZ);
@@ -361,7 +360,7 @@ int wfx_probe(struct wfx_dev *wdev)
 		} else if (err == -ERESTARTSYS) {
 			dev_info(wdev->dev, "probe interrupted by user\n");
 		}
-		goto err0;
+		goto bh_unregister;
 	}
 
 	/* FIXME: fill wiphy::hw_version */
@@ -380,13 +379,13 @@ int wfx_probe(struct wfx_dev *wdev)
 	if (wfx_api_older_than(wdev, 1, 0)) {
 		dev_err(wdev->dev, "unsupported firmware API version (expect 1 while firmware returns %d)\n",
 			wdev->hw_caps.api_version_major);
-		err = -ENOTSUPP;
-		goto err0;
+		err = -EOPNOTSUPP;
+		goto bh_unregister;
 	}
 
 	if (wdev->hw_caps.link_mode == SEC_LINK_ENFORCED) {
 		dev_err(wdev->dev, "chip require secure_link, but can't negotiate it\n");
-		goto err0;
+		goto bh_unregister;
 	}
 
 	if (wdev->hw_caps.region_sel_mode) {
@@ -401,12 +400,12 @@ int wfx_probe(struct wfx_dev *wdev)
 	dev_dbg(wdev->dev, "sending configuration file %s\n", wdev->pdata.file_pds);
 	err = wfx_send_pdata_pds(wdev);
 	if (err < 0 && err != -ENOENT)
-		goto err0;
+		goto bh_unregister;
 
 	wdev->poll_irq = false;
 	err = wdev->hwbus_ops->irq_subscribe(wdev->hwbus_priv);
 	if (err)
-		goto err0;
+		goto bh_unregister;
 
 	err = wfx_hif_use_multi_tx_conf(wdev, true);
 	if (err)
@@ -444,19 +443,19 @@ int wfx_probe(struct wfx_dev *wdev)
 
 	err = ieee80211_register_hw(wdev->hw);
 	if (err)
-		goto err1;
+		goto irq_unsubscribe;
 
 	err = wfx_debug_init(wdev);
 	if (err)
-		goto err2;
+		goto ieee80211_unregister;
 
 	return 0;
 
-err2:
+ieee80211_unregister:
 	ieee80211_unregister_hw(wdev->hw);
-err1:
+irq_unsubscribe:
 	wdev->hwbus_ops->irq_unsubscribe(wdev->hwbus_priv);
-err0:
+bh_unregister:
 	wfx_bh_unregister(wdev);
 	return err;
 }
-- 
2.34.1


  parent reply	other threads:[~2022-01-13  8:57 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-13  8:54 [PATCH 00/31] staging/wfx: apply suggestions from the linux-wireless review Jerome Pouiller
2022-01-13  8:54 ` [PATCH 01/31] staging: wfx: fix Makefile and Kconfig licenses Jerome Pouiller
2022-01-13  8:54 ` [PATCH 02/31] staging: wfx: fix HIF API license Jerome Pouiller
2022-01-13 11:50   ` Kalle Valo
2022-01-13 12:16     ` Jérôme Pouiller
2022-01-13  8:54 ` [PATCH 03/31] staging: wfx: fix missing headers Jerome Pouiller
2022-01-13  8:54 ` [PATCH 04/31] staging: wfx: fix comment correctness Jerome Pouiller
2022-01-13  8:54 ` [PATCH 05/31] staging: wfx: explain uncommon Makefile statement Jerome Pouiller
2022-01-13  8:54 ` [PATCH 06/31] staging: wfx: remove unnecessary braces Jerome Pouiller
2022-01-13  8:55 ` [PATCH 07/31] staging: wfx: remove useless #ifdef Jerome Pouiller
2022-01-13  8:55 ` [PATCH 08/31] staging: wfx: use IS_ALIGNED() Jerome Pouiller
2022-01-13  8:55 ` [PATCH 09/31] staging: wfx: replace magic value by WFX_HIF_BUFFER_SIZE Jerome Pouiller
2022-01-13  8:55 ` [PATCH 10/31] stagigg: wfx: replace magic number by HIF_ID_IS_INDICATION Jerome Pouiller
2022-01-13  8:55 ` [PATCH 11/31] staging: wfx: preserve endianness of struct hif_ind_startup Jerome Pouiller
2022-01-13  8:55 ` [PATCH 12/31] staging: wfx: fix ambiguous function name Jerome Pouiller
2022-01-13  8:55 ` [PATCH 13/31] " Jerome Pouiller
2022-01-13  8:55 ` [PATCH 14/31] staging: wfx: prefix functions from hif_*.h with wfx_ Jerome Pouiller
2022-01-13  8:55 ` [PATCH 15/31] staging: wfx: prefix functions from hwio.h " Jerome Pouiller
2022-01-13  8:55 ` [PATCH 16/31] staging: wfx: prefix functions from debug.h " Jerome Pouiller
2022-01-13  8:55 ` [PATCH 17/31] staging: wfx: prefix tx_policy_is_equal() " Jerome Pouiller
2022-01-13  8:55 ` [PATCH 18/31] staging: wfx: prefix structs hif_* " Jerome Pouiller
2022-01-13  8:55 ` [PATCH 19/31] staging: wfx: prefix structs tx_policy and hwbus_ops " Jerome Pouiller
2022-01-13  8:55 ` [PATCH 20/31] staging: wfx: reformat code on 100 columns Jerome Pouiller
2022-01-13  8:55 ` [PATCH 21/31] staging: wfx: reformat comments " Jerome Pouiller
2022-01-13  8:55 ` [PATCH 22/31] staging: wfx: fix structs alignments Jerome Pouiller
2022-01-13  8:55 ` Jerome Pouiller [this message]
2022-01-13  8:55 ` [PATCH 24/31] staging: wfx: replace compiletime_assert() by BUILD_BUG_ON_MSG() Jerome Pouiller
2022-01-13  8:55 ` [PATCH 25/31] staging: wfx: do not display functions names in logs Jerome Pouiller
2022-01-13  8:55 ` [PATCH 26/31] staging: wfx: remove force_ps_timeout Jerome Pouiller
2022-01-13  8:55 ` [PATCH 27/31] staging: wfx: map 'compatible' attribute with board name Jerome Pouiller
2022-01-13  8:55 ` [PATCH 28/31] staging: wfx: fix firmware location Jerome Pouiller
2022-01-13  8:55 ` [PATCH 29/31] staging: wfx: drop legacy compatible values Jerome Pouiller
2022-01-13  8:55 ` [PATCH 30/31] staging: wfx: rename "config-file" DT attribute Jerome Pouiller
2022-01-13  8:55 ` [PATCH 31/31] staging: wfx: do not probe the device if not in the DT Jerome Pouiller

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=20220113085524.1110708-24-Jerome.Pouiller@silabs.com \
    --to=jerome.pouiller@silabs.com \
    --cc=davem@davemloft.net \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=kvalo@codeaurora.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=netdev@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 read-only IMAP folder(s) and NNTP newsgroup(s).