diff mbox

[4/5] wlcore: Use common error handling code in wlcore_set_beacon_template()

Message ID f50c8edf-834d-9003-5a3c-dc83ec4016ce@users.sourceforge.net (mailing list archive)
State Rejected
Delegated to: Kalle Valo
Headers show

Commit Message

SF Markus Elfring Oct. 29, 2017, 8:14 p.m. UTC
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(-)

Comments

Julian Calaby Oct. 30, 2017, 1:33 p.m. UTC | #1
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,
SF Markus Elfring Oct. 30, 2017, 1:44 p.m. UTC | #2
>> @@ -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
diff mbox

Patch

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;
 }