package/devel/binutils: Update to 2.27
[openwrt/staging/yousong.git] / package / kernel / mac80211 / patches / 653-0003-rtl8xxxu-Fix-error-handling-if-rtl8xxxu_init_device-.patch
1 From deb6176e561324884652dd6a49a862bd8b152959 Mon Sep 17 00:00:00 2001
2 From: Jes Sorensen <Jes.Sorensen@redhat.com>
3 Date: Fri, 19 Aug 2016 17:46:25 -0400
4 Subject: [PATCH] rtl8xxxu: Fix error handling if rtl8xxxu_init_device() fails
5
6 For some reason we lost the code bailing if rtl8xxxu_init_device()
7 returned an error.
8
9 This catches the error and also cleans up the error handling.
10
11 Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
12 Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
13 ---
14 .../net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 20 +++++++++++++++++---
15 1 file changed, 17 insertions(+), 3 deletions(-)
16
17 --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
18 +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
19 @@ -5947,7 +5947,7 @@ static int rtl8xxxu_probe(struct usb_int
20 struct ieee80211_hw *hw;
21 struct usb_device *udev;
22 struct ieee80211_supported_band *sband;
23 - int ret = 0;
24 + int ret;
25 int untested = 1;
26
27 udev = usb_get_dev(interface_to_usbdev(interface));
28 @@ -5995,6 +5995,7 @@ static int rtl8xxxu_probe(struct usb_int
29 hw = ieee80211_alloc_hw(sizeof(struct rtl8xxxu_priv), &rtl8xxxu_ops);
30 if (!hw) {
31 ret = -ENOMEM;
32 + priv = NULL;
33 goto exit;
34 }
35
36 @@ -6043,6 +6044,8 @@ static int rtl8xxxu_probe(struct usb_int
37 }
38
39 ret = rtl8xxxu_init_device(hw);
40 + if (ret)
41 + goto exit;
42
43 hw->wiphy->max_scan_ssids = 1;
44 hw->wiphy->max_scan_ie_len = IEEE80211_MAX_DATA_LEN;
45 @@ -6093,9 +6096,20 @@ static int rtl8xxxu_probe(struct usb_int
46 goto exit;
47 }
48
49 + return 0;
50 +
51 exit:
52 - if (ret < 0)
53 - usb_put_dev(udev);
54 + usb_set_intfdata(interface, NULL);
55 +
56 + if (priv) {
57 + kfree(priv->fw_data);
58 + mutex_destroy(&priv->usb_buf_mutex);
59 + mutex_destroy(&priv->h2c_mutex);
60 + }
61 + usb_put_dev(udev);
62 +
63 + ieee80211_free_hw(hw);
64 +
65 return ret;
66 }
67