public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/5] wlcore: Fine-tuning for three function implementations
@ 2017-10-29 20:10 SF Markus Elfring
  2017-10-29 20:11 ` [PATCH 1/5] wlcore: Use common error handling code in wlcore_nvs_cb() SF Markus Elfring
                   ` (4 more replies)
  0 siblings, 5 replies; 13+ messages in thread
From: SF Markus Elfring @ 2017-10-29 20:10 UTC (permalink / raw)
  To: linux-wireless, netdev, Arend Van Spriel, Eyal Reizer,
	Iain Hunter, James Minor, Johannes Berg, Kalle Valo,
	Maxim Altshul, Pieter-Paul Giesberts
  Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sun, 29 Oct 2017 21:02:34 +0100

A few update suggestions were taken into account
from static source code analysis.

Markus Elfring (5):
  Use common error handling code in wlcore_nvs_cb()
  Delete an unnecessary check statement in wlcore_set_beacon_template()
  Return directly after a failed ieee80211_beacon_get()
    in wlcore_set_beacon_template()
  Use common error handling code in wlcore_set_beacon_template()
  Use common error handling code in wl1271_op_suspend()

 drivers/net/wireless/ti/wlcore/main.c | 51 ++++++++++++++++-------------------
 1 file changed, 23 insertions(+), 28 deletions(-)

-- 
2.14.3


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH 1/5] wlcore: Use common error handling code in wlcore_nvs_cb()
  2017-10-29 20:10 [PATCH 0/5] wlcore: Fine-tuning for three function implementations SF Markus Elfring
@ 2017-10-29 20:11 ` SF Markus Elfring
  2017-10-30 13:28   ` Julian Calaby
  2017-10-29 20:12 ` [PATCH 2/5] wlcore: Delete an unnecessary check statement in wlcore_set_beacon_template() SF Markus Elfring
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 13+ messages in thread
From: SF Markus Elfring @ 2017-10-29 20:11 UTC (permalink / raw)
  To: linux-wireless, netdev, Arend Van Spriel, Eyal Reizer,
	Iain Hunter, James Minor, Johannes Berg, Kalle Valo,
	Maxim Altshul, Pieter-Paul Giesberts
  Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sun, 29 Oct 2017 18:38:04 +0100

Add a jump target so that a bit of exception handling can be better reused
at the end of this function.

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 | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/ti/wlcore/main.c b/drivers/net/wireless/ti/wlcore/main.c
index c346c021b999..48380d48ef09 100644
--- a/drivers/net/wireless/ti/wlcore/main.c
+++ b/drivers/net/wireless/ti/wlcore/main.c
@@ -6496,16 +6496,14 @@ static void wlcore_nvs_cb(const struct firmware *fw, void *context)
 	ret = wl12xx_get_hw_info(wl);
 	if (ret < 0) {
 		wl1271_error("couldn't get hw info");
-		wl1271_power_off(wl);
-		goto out_free_nvs;
+		goto power_off;
 	}
 
 	ret = request_threaded_irq(wl->irq, hardirq_fn, wlcore_irq,
 				   wl->irq_flags, pdev->name, wl);
 	if (ret < 0) {
 		wl1271_error("interrupt configuration failed");
-		wl1271_power_off(wl);
-		goto out_free_nvs;
+		goto power_off;
 	}
 
 #ifdef CONFIG_PM
@@ -6551,6 +6549,11 @@ static void wlcore_nvs_cb(const struct firmware *fw, void *context)
 out:
 	release_firmware(fw);
 	complete_all(&wl->nvs_loading_complete);
+	return;
+
+power_off:
+	wl1271_power_off(wl);
+	goto out_free_nvs;
 }
 
 int wlcore_probe(struct wl1271 *wl, struct platform_device *pdev)
-- 
2.14.3


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 2/5] wlcore: Delete an unnecessary check statement in wlcore_set_beacon_template()
  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-29 20:12 ` 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
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 13+ messages in thread
From: SF Markus Elfring @ 2017-10-29 20:12 UTC (permalink / raw)
  To: linux-wireless, netdev, Arend Van Spriel, Eyal Reizer,
	Iain Hunter, James Minor, Johannes Berg, Kalle Valo,
	Maxim Altshul, Pieter-Paul Giesberts
  Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sun, 29 Oct 2017 19:45:07 +0100

A goto statement jumped to a target which followed a condition check
immediately without the specification of useful actions between.
Thus remove such unnecessary source code at the end of this function.

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

diff --git a/drivers/net/wireless/ti/wlcore/main.c b/drivers/net/wireless/ti/wlcore/main.c
index 48380d48ef09..efea811c1c83 100644
--- a/drivers/net/wireless/ti/wlcore/main.c
+++ b/drivers/net/wireless/ti/wlcore/main.c
@@ -4085,9 +4085,6 @@ static int wlcore_set_beacon_template(struct wl1271 *wl,
 					      min_rate);
 end_bcn:
 	dev_kfree_skb(beacon);
-	if (ret < 0)
-		goto out;
-
 out:
 	return ret;
 }
-- 
2.14.3


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 3/5] wlcore: Return directly after a failed ieee80211_beacon_get() in wlcore_set_beacon_templ
  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-29 20:12 ` [PATCH 2/5] wlcore: Delete an unnecessary check statement in wlcore_set_beacon_template() SF Markus Elfring
@ 2017-10-29 20:13 ` 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-29 20:16 ` [PATCH 5/5] wlcore: Use common error handling code in wl1271_op_suspend() SF Markus Elfring
  4 siblings, 1 reply; 13+ messages in thread
From: SF Markus Elfring @ 2017-10-29 20:13 UTC (permalink / raw)
  To: linux-wireless, netdev, Arend Van Spriel, Eyal Reizer,
	Iain Hunter, James Minor, Johannes Berg, Kalle Valo,
	Maxim Altshul, Pieter-Paul Giesberts
  Cc: LKML, kernel-janitors

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

Return directly after a call of the function "ieee80211_beacon_get"
failed at the beginning.

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

diff --git a/drivers/net/wireless/ti/wlcore/main.c b/drivers/net/wireless/ti/wlcore/main.c
index efea811c1c83..0365b5e40a8d 100644
--- a/drivers/net/wireless/ti/wlcore/main.c
+++ b/drivers/net/wireless/ti/wlcore/main.c
@@ -4018,10 +4018,8 @@ static int wlcore_set_beacon_template(struct wl1271 *wl,
 	struct sk_buff *beacon = ieee80211_beacon_get(wl->hw, vif);
 	u16 tmpl_id;
 
-	if (!beacon) {
-		ret = -EINVAL;
-		goto out;
-	}
+	if (!beacon)
+		return -EINVAL;
 
 	wl1271_debug(DEBUG_MASTER, "beacon updated");
 
-- 
2.14.3


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 4/5] wlcore: Use common error handling code in wlcore_set_beacon_template()
  2017-10-29 20:10 [PATCH 0/5] wlcore: Fine-tuning for three function implementations SF Markus Elfring
                   ` (2 preceding siblings ...)
  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-29 20:14 ` SF Markus Elfring
  2017-10-30 13:33   ` Julian Calaby
  2017-10-29 20:16 ` [PATCH 5/5] wlcore: Use common error handling code in wl1271_op_suspend() SF Markus Elfring
  4 siblings, 1 reply; 13+ messages in thread
From: SF Markus Elfring @ 2017-10-29 20:14 UTC (permalink / raw)
  To: linux-wireless, netdev, Arend Van Spriel, Eyal Reizer,
	Iain Hunter, James Minor, Johannes Berg, Kalle Valo,
	Maxim Altshul, Pieter-Paul Giesberts
  Cc: LKML, kernel-janitors

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

Adjust jump targets so that a bit of exception handling can be better
reused at the end of this function.

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 | 18 +++++++-----------
 1 file changed, 7 insertions(+), 11 deletions(-)

diff --git a/drivers/net/wireless/ti/wlcore/main.c b/drivers/net/wireless/ti/wlcore/main.c
index 0365b5e40a8d..12a9d6509382 100644
--- a/drivers/net/wireless/ti/wlcore/main.c
+++ b/drivers/net/wireless/ti/wlcore/main.c
@@ -4024,10 +4024,9 @@ static int wlcore_set_beacon_template(struct wl1271 *wl,
 	wl1271_debug(DEBUG_MASTER, "beacon updated");
 
 	ret = wl1271_ssid_set(wlvif, beacon, ieoffset);
-	if (ret < 0) {
-		dev_kfree_skb(beacon);
-		goto out;
-	}
+	if (ret < 0)
+		goto free_skb;
+
 	min_rate = wl1271_tx_min_rate_get(wl, wlvif->basic_rate_set);
 	tmpl_id = is_ap ? CMD_TEMPL_AP_BEACON :
 		CMD_TEMPL_BEACON;
@@ -4035,10 +4034,8 @@ static int wlcore_set_beacon_template(struct wl1271 *wl,
 				      beacon->data,
 				      beacon->len, 0,
 				      min_rate);
-	if (ret < 0) {
-		dev_kfree_skb(beacon);
-		goto out;
-	}
+	if (ret < 0)
+		goto free_skb;
 
 	wlvif->wmm_enabled  		cfg80211_find_vendor_ie(WLAN_OUI_MICROSOFT,
@@ -4051,7 +4048,7 @@ static int wlcore_set_beacon_template(struct wl1271 *wl,
 	 * by usermode, don't use the beacon data.
 	 */
 	if (test_bit(WLVIF_FLAG_AP_PROBE_RESP_SET, &wlvif->flags))
-		goto end_bcn;
+		goto free_skb;
 
 	/* remove TIM ie from probe response */
 	wl12xx_remove_ie(beacon, WLAN_EID_TIM, ieoffset);
@@ -4081,9 +4078,8 @@ static int wlcore_set_beacon_template(struct wl1271 *wl,
 					      beacon->data,
 					      beacon->len, 0,
 					      min_rate);
-end_bcn:
+free_skb:
 	dev_kfree_skb(beacon);
-out:
 	return ret;
 }
 
-- 
2.14.3


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 5/5] wlcore: Use common error handling code in wl1271_op_suspend()
  2017-10-29 20:10 [PATCH 0/5] wlcore: Fine-tuning for three function implementations SF Markus Elfring
                   ` (3 preceding siblings ...)
  2017-10-29 20:14 ` [PATCH 4/5] wlcore: Use common error handling code in wlcore_set_beacon_template() SF Markus Elfring
@ 2017-10-29 20:16 ` SF Markus Elfring
  2017-10-30 13:40   ` Julian Calaby
  4 siblings, 1 reply; 13+ messages in thread
From: SF Markus Elfring @ 2017-10-29 20:16 UTC (permalink / raw)
  To: linux-wireless, netdev, Arend Van Spriel, Eyal Reizer,
	Iain Hunter, James Minor, Johannes Berg, Kalle Valo,
	Maxim Altshul, Pieter-Paul Giesberts
  Cc: LKML, kernel-janitors

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


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH 2/5] wlcore: Delete an unnecessary check statement in wlcore_set_beacon_template()
  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
  0 siblings, 0 replies; 13+ messages in thread
From: Julian Calaby @ 2017-10-30 13:26 UTC (permalink / raw)
  To: SF Markus Elfring
  Cc: linux-wireless, netdev, Arend Van Spriel, Eyal Reizer,
	Iain Hunter, James Minor, Johannes Berg, Kalle Valo,
	Maxim Altshul, Pieter-Paul Giesberts, LKML, kernel-janitors

On Mon, Oct 30, 2017 at 7:12 AM, SF Markus Elfring
<elfring@users.sourceforge.net> wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Sun, 29 Oct 2017 19:45:07 +0100
>
> A goto statement jumped to a target which followed a condition check
> immediately without the specification of useful actions between.
> Thus remove such unnecessary source code at the end of this function.
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>

Looks good to me.

Reviewed-by: Julian Calaby <julian.calaby@gmail.com>

-- 
Julian Calaby

Email: julian.calaby@gmail.com
Profile: http://www.google.com/profiles/julian.calaby/

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 1/5] wlcore: Use common error handling code in wlcore_nvs_cb()
  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
  0 siblings, 1 reply; 13+ messages in thread
From: Julian Calaby @ 2017-10-30 13:28 UTC (permalink / raw)
  To: SF Markus Elfring
  Cc: linux-wireless, netdev, Arend Van Spriel, Eyal Reizer,
	Iain Hunter, James Minor, Johannes Berg, Kalle Valo,
	Maxim Altshul, Pieter-Paul Giesberts, LKML, kernel-janitors

Hi Markus,

On Mon, Oct 30, 2017 at 7:11 AM, SF Markus Elfring
<elfring@users.sourceforge.net> wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Sun, 29 Oct 2017 18:38:04 +0100
>
> Add a jump target so that a bit of exception handling can be better reused
> at the end of this function.
>
> 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 | 11 +++++++----
>  1 file changed, 7 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/net/wireless/ti/wlcore/main.c b/drivers/net/wireless/ti/wlcore/main.c
> index c346c021b999..48380d48ef09 100644
> --- a/drivers/net/wireless/ti/wlcore/main.c
> +++ b/drivers/net/wireless/ti/wlcore/main.c
> @@ -6551,6 +6549,11 @@ static void wlcore_nvs_cb(const struct firmware *fw, void *context)
>  out:
>         release_firmware(fw);
>         complete_all(&wl->nvs_loading_complete);
> +       return;
> +
> +power_off:

Name this "out_power_off" to match the other labels.

> +       wl1271_power_off(wl);
> +       goto out_free_nvs;

Why not put this in front of the out_free_nvs label? It looks weird here.

Thanks,

-- 
Julian Calaby

Email: julian.calaby@gmail.com
Profile: http://www.google.com/profiles/julian.calaby/

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 3/5] wlcore: Return directly after a failed ieee80211_beacon_get() in wlcore_set_beacon_t
  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   ` Julian Calaby
  0 siblings, 0 replies; 13+ messages in thread
From: Julian Calaby @ 2017-10-30 13:32 UTC (permalink / raw)
  To: SF Markus Elfring
  Cc: linux-wireless, netdev, Arend Van Spriel, Eyal Reizer,
	Iain Hunter, James Minor, Johannes Berg, Kalle Valo,
	Maxim Altshul, Pieter-Paul Giesberts, LKML, kernel-janitors

On Mon, Oct 30, 2017 at 7:13 AM, SF Markus Elfring
<elfring@users.sourceforge.net> wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Sun, 29 Oct 2017 20:00:41 +0100
>
> Return directly after a call of the function "ieee80211_beacon_get"
> failed at the beginning.
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>

Reviewed-by: Julian Calaby <julian.calaby@gmail.com>

Thanks,

-- 
Julian Calaby

Email: julian.calaby@gmail.com
Profile: http://www.google.com/profiles/julian.calaby/

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 4/5] wlcore: Use common error handling code in wlcore_set_beacon_template()
  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
  0 siblings, 1 reply; 13+ messages in thread
From: Julian Calaby @ 2017-10-30 13:33 UTC (permalink / raw)
  To: SF Markus Elfring
  Cc: linux-wireless, netdev, Arend Van Spriel, Eyal Reizer,
	Iain Hunter, James Minor, Johannes Berg, Kalle Valo,
	Maxim Altshul, Pieter-Paul Giesberts, LKML, kernel-janitors

Hi Markus,

On Mon, Oct 30, 2017 at 7:14 AM, SF Markus Elfring
<elfring@users.sourceforge.net> wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Sun, 29 Oct 2017 20:16:22 +0100
>
> Adjust jump targets so that a bit of exception handling can be better
> reused at the end of this function.
>
> This issue was detected by using the Coccinelle software.
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>

Reviewed-by: Julian Calaby <julian.calaby@gmail.com>

However,

> ---
>  drivers/net/wireless/ti/wlcore/main.c | 18 +++++++-----------
>  1 file changed, 7 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/net/wireless/ti/wlcore/main.c b/drivers/net/wireless/ti/wlcore/main.c
> index 0365b5e40a8d..12a9d6509382 100644
> --- a/drivers/net/wireless/ti/wlcore/main.c
> +++ b/drivers/net/wireless/ti/wlcore/main.c
> @@ -4081,9 +4078,8 @@ static int wlcore_set_beacon_template(struct wl1271 *wl,
>                                               beacon->data,
>                                               beacon->len, 0,
>                                               min_rate);
> -end_bcn:
> +free_skb:

Why rename the label?

Thanks,

-- 
Julian Calaby

Email: julian.calaby@gmail.com
Profile: http://www.google.com/profiles/julian.calaby/

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 5/5] wlcore: Use common error handling code in wl1271_op_suspend()
  2017-10-29 20:16 ` [PATCH 5/5] wlcore: Use common error handling code in wl1271_op_suspend() SF Markus Elfring
@ 2017-10-30 13:40   ` Julian Calaby
  0 siblings, 0 replies; 13+ messages in thread
From: Julian Calaby @ 2017-10-30 13:40 UTC (permalink / raw)
  To: SF Markus Elfring
  Cc: linux-wireless, netdev, Arend Van Spriel, Eyal Reizer,
	Iain Hunter, James Minor, Johannes Berg, Kalle Valo,
	Maxim Altshul, Pieter-Paul Giesberts, LKML, kernel-janitors

Hi Markus,

On Mon, Oct 30, 2017 at 7:16 AM, SF Markus Elfring
<elfring@users.sourceforge.net> wrote:
> 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>

This patch is bogus, moving error messages around like this is just bizarre.

These are both reporting different failures, so the error messages
should be different.

> ---
>  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");

"couldn't configure device for 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");

"couldn't enable power saving"?

> -               return ret;
> -       }
> +       if (ret < 0)
> +               goto report_preparation_failure;
>
>         /* flush any remaining work */
>         wl1271_debug(DEBUG_MAC80211, "flushing remaining works");

Thanks,

-- 
Julian Calaby

Email: julian.calaby@gmail.com
Profile: http://www.google.com/profiles/julian.calaby/

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 1/5] wlcore: Use common error handling code in wlcore_nvs_cb()
  2017-10-30 13:28   ` Julian Calaby
@ 2017-10-30 13:40     ` SF Markus Elfring
  0 siblings, 0 replies; 13+ messages in thread
From: SF Markus Elfring @ 2017-10-30 13:40 UTC (permalink / raw)
  To: Julian Calaby, linux-wireless, netdev
  Cc: Arend Van Spriel, Eyal Reizer, Iain Hunter, James Minor,
	Johannes Berg, Kalle Valo, Maxim Altshul, Pieter-Paul Giesberts,
	LKML, kernel-janitors

>> @@ -6551,6 +6549,11 @@ static void wlcore_nvs_cb(const struct firmware *fw, void *context)
>>  out:
>>         release_firmware(fw);
>>         complete_all(&wl->nvs_loading_complete);
>> +       return;
>> +
>> +power_off:
> 
> Name this "out_power_off" to match the other labels.

Do you expect a second approach for this patch series then?


>> +       wl1271_power_off(wl);
>> +       goto out_free_nvs;
> 
> Why not put this in front of the out_free_nvs label?

It seems that I can not really follow this suggestion at the moment.


> It looks weird here.

Which detail do you not like?

Regards,
Markus

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 4/5] wlcore: Use common error handling code in wlcore_set_beacon_template()
  2017-10-30 13:33   ` Julian Calaby
@ 2017-10-30 13:44     ` SF Markus Elfring
  0 siblings, 0 replies; 13+ messages in thread
From: SF Markus Elfring @ 2017-10-30 13:44 UTC (permalink / raw)
  To: Julian Calaby, linux-wireless, netdev
  Cc: Arend Van Spriel, Eyal Reizer, Iain Hunter, James Minor,
	Johannes Berg, Kalle Valo, Maxim Altshul, Pieter-Paul Giesberts,
	LKML, kernel-janitors

>> @@ -4081,9 +4078,8 @@ static int wlcore_set_beacon_template(struct wl1271 *wl,
>>                                               beacon->data,
>>                                               beacon->len, 0,
>>                                               min_rate);
>> -end_bcn:
>> +free_skb:
> 
> Why rename the label?

I find it clearer according to the Linux coding style.

Regards,
Markus

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2017-10-30 13:44 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 ` [PATCH 5/5] wlcore: Use common error handling code in wl1271_op_suspend() SF Markus Elfring
2017-10-30 13:40   ` Julian Calaby

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox