public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
From: SF Markus Elfring <elfring@users.sourceforge.net>
To: linux-wireless@vger.kernel.org, netdev@vger.kernel.org,
	Arend Van Spriel <arend.vanspriel@broadcom.com>,
	Eyal Reizer <eyalr@ti.com>, Iain Hunter <drhunter95@gmail.com>,
	James Minor <james.minor@ni.com>,
	Johannes Berg <johannes.berg@intel.com>,
	Kalle Valo <kvalo@codeaurora.org>,
	Maxim Altshul <maxim.altshul@ti.com>,
	Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
Cc: LKML <linux-kernel@vger.kernel.org>, kernel-janitors@vger.kernel.org
Subject: [PATCH 5/5] wlcore: Use common error handling code in wl1271_op_suspend()
Date: Sun, 29 Oct 2017 20:16:02 +0000	[thread overview]
Message-ID: <5c4844e8-b519-888d-c772-4f925a4f2a66@users.sourceforge.net> (raw)
In-Reply-To: <dc2b8a7c-b4a9-2f92-12b4-a1d0d6911d7c@users.sourceforge.net>

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sun, 29 Oct 2017 20:36:39 +0100

Add a jump target so that a specific error message is stored only once
at the end of this function implementation.
Replace two calls of the macro "wl1271_warning" by goto statements.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/net/wireless/ti/wlcore/main.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/net/wireless/ti/wlcore/main.c b/drivers/net/wireless/ti/wlcore/main.c
index 12a9d6509382..a110f61110d5 100644
--- a/drivers/net/wireless/ti/wlcore/main.c
+++ b/drivers/net/wireless/ti/wlcore/main.c
@@ -1732,8 +1732,7 @@ static int wl1271_op_suspend(struct ieee80211_hw *hw,
 		ret = wl1271_configure_suspend(wl, wlvif, wow);
 		if (ret < 0) {
 			mutex_unlock(&wl->mutex);
-			wl1271_warning("couldn't prepare device to suspend");
-			return ret;
+			goto report_preparation_failure;
 		}
 	}
 
@@ -1752,10 +1751,8 @@ static int wl1271_op_suspend(struct ieee80211_hw *hw,
 	wl1271_ps_elp_sleep(wl);
 	mutex_unlock(&wl->mutex);
 
-	if (ret < 0) {
-		wl1271_warning("couldn't prepare device to suspend");
-		return ret;
-	}
+	if (ret < 0)
+		goto report_preparation_failure;
 
 	/* flush any remaining work */
 	wl1271_debug(DEBUG_MAC80211, "flushing remaining works");
@@ -1783,6 +1780,10 @@ static int wl1271_op_suspend(struct ieee80211_hw *hw,
 	cancel_delayed_work(&wl->tx_watchdog_work);
 
 	return 0;
+
+report_preparation_failure:
+	wl1271_warning("couldn't prepare device to suspend");
+	return ret;
 }
 
 static int wl1271_op_resume(struct ieee80211_hw *hw)
-- 
2.14.3


  parent reply	other threads:[~2017-10-29 20:16 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-29 20:10 [PATCH 0/5] wlcore: Fine-tuning for three function implementations SF Markus Elfring
2017-10-29 20:11 ` [PATCH 1/5] wlcore: Use common error handling code in wlcore_nvs_cb() SF Markus Elfring
2017-10-30 13:28   ` Julian Calaby
2017-10-30 13:40     ` SF Markus Elfring
2017-10-29 20:12 ` [PATCH 2/5] wlcore: Delete an unnecessary check statement in wlcore_set_beacon_template() SF Markus Elfring
2017-10-30 13:26   ` Julian Calaby
2017-10-29 20:13 ` [PATCH 3/5] wlcore: Return directly after a failed ieee80211_beacon_get() in wlcore_set_beacon_templ SF Markus Elfring
2017-10-30 13:32   ` [PATCH 3/5] wlcore: Return directly after a failed ieee80211_beacon_get() in wlcore_set_beacon_t Julian Calaby
2017-10-29 20:14 ` [PATCH 4/5] wlcore: Use common error handling code in wlcore_set_beacon_template() SF Markus Elfring
2017-10-30 13:33   ` Julian Calaby
2017-10-30 13:44     ` SF Markus Elfring
2017-10-29 20:16 ` SF Markus Elfring [this message]
2017-10-30 13:40   ` [PATCH 5/5] wlcore: Use common error handling code in wl1271_op_suspend() Julian Calaby

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=5c4844e8-b519-888d-c772-4f925a4f2a66@users.sourceforge.net \
    --to=elfring@users.sourceforge.net \
    --cc=arend.vanspriel@broadcom.com \
    --cc=drhunter95@gmail.com \
    --cc=eyalr@ti.com \
    --cc=james.minor@ni.com \
    --cc=johannes.berg@intel.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=kvalo@codeaurora.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=maxim.altshul@ti.com \
    --cc=netdev@vger.kernel.org \
    --cc=pieter-paul.giesberts@broadcom.com \
    /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