From patchwork Sun Oct 29 20:14:30 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SF Markus Elfring X-Patchwork-Id: 10031651 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id A2116600C5 for ; Sun, 29 Oct 2017 20:15:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 95F7D28759 for ; Sun, 29 Oct 2017 20:15:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8A3A22875B; Sun, 29 Oct 2017 20:15:10 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8440228759 for ; Sun, 29 Oct 2017 20:15:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751900AbdJ2UOt (ORCPT ); Sun, 29 Oct 2017 16:14:49 -0400 Received: from mout.web.de ([212.227.15.3]:64324 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751315AbdJ2UOr (ORCPT ); Sun, 29 Oct 2017 16:14:47 -0400 Received: from [192.168.1.2] ([78.49.32.239]) by smtp.web.de (mrweb001 [213.165.67.108]) with ESMTPSA (Nemesis) id 0LaTtv-1dRpqg2d8p-00mJu6; Sun, 29 Oct 2017 21:14:34 +0100 Subject: [PATCH 4/5] wlcore: Use common error handling code in wlcore_set_beacon_template() From: SF Markus Elfring To: linux-wireless@vger.kernel.org, netdev@vger.kernel.org, Arend Van Spriel , Eyal Reizer , Iain Hunter , James Minor , Johannes Berg , Kalle Valo , Maxim Altshul , Pieter-Paul Giesberts Cc: LKML , kernel-janitors@vger.kernel.org References: Message-ID: Date: Sun, 29 Oct 2017 21:14:30 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: Content-Language: en-GB X-Provags-ID: V03:K0:A7WhOrHEMNMoREvtgSIwdhAUatGjmGBFuCujIzuJ+71P/KFxfQI Zft6qwHOzHn0Krs3XbJ8I2Y4Zi8++hMiaGQjKql3+QnBsgjl87Xo3U036ganDHm6i3OSNs6 cNSsaUgddvGVsHABr+G67iNPFO7/+JysK+xFyC22DTXiVDHlAF59txivZdMOY9KM+L9LoHs 9HjAxKfvo9aYbsCHNDQ4w== X-UI-Out-Filterresults: notjunk:1; V01:K0:IQffZaQb5g0=:SP662KlX0s5N4a4B8cgNzw A3u+yJUa362yneHu7MxlEGUaRagkB9ipCJWLjvUyhaTEAal1Bzw7FgJS7NB7I+E19RiMfn93X Hjtfp+Hd5WEfzZ0HHyc2jFDCjeb/18fRwJFsSZrn7owfPc+x8ruphA8M/Z1ptaOkw5XKRpb+H gTKWNFxGataLFqUcpVim3DSLR3ZTI4yItdvPdfV6sKGdvux5B/sNEmtQB4Z+ctJxWZjnGwLfx /CabIEhVYGhuEkgUV4/BgA5Ro1xqJSqAEFUDuBbFRJhGq+DuaBOLCnZv6lNM8rdZ/qot+vMG8 gFmzKk+AJHOBzSpB7dbf9mbD7344tZYzoCI7/H9LRK+klBAiVejX1n/+aXz3BjKByiolPHwAM SOKQDFeDMolW6q1B5HnZkwRralkyQPWX9s2H55Fb9DL9ti9SiDj84WQ5/aNhvJkC1TnVlAver h0Mr+hBeG+5kRb8E74MexMIgsOS8PuvLJ0KlfNSoJEm7t7lNrI6C0zYX8j2Y/TuIKagVyfg0P j/PhLO8Z421aK2diZdW3PlIjPuTRKYfFQslKfO1caN/TwJY+4ueETeAJsHkXMbpOFtQs6ZtRr 25hzp7D7yobc87ELVExegcGwBV4we4We9XSVKCBoU3mGkVbHJvjImm57rqcANFB3ruluIOOR8 VABQsY5itMbNR2A9xWdUra12iDKb5InVq2uSh2/rDDoGLjgOOqFl2feHzVKSFIksRe3gDf/Z4 L/Mp2MtI2LvUnLPX7rtkbivugn86J2h4Y1/MvMGE7biOXeMm8VtchY+SChkssLZ66vSdzF2F9 YODrAyOIB7iXlRLwGr0Os2lQghiM0l9ceFywW73VocEZroGdic= Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Markus Elfring 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 Reviewed-by: Julian Calaby --- 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; }