rtl8xxxu: add support for rtl8188eu
[openwrt/staging/rmilecki.git] / package / kernel / mac80211 / patches / 651-0003-rtl8xxxu-Fix-error-handling-if-rtl8xxxu_init_device-.patch
1 From 70a3605d6d1922411b8a78499d58f140565353f7 Mon Sep 17 00:00:00 2001
2 From: Jes Sorensen <Jes.Sorensen@redhat.com>
3 Date: Wed, 29 Jun 2016 14:42:18 -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 ---
13 .../net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 20 +++++++++++++++++---
14 1 file changed, 17 insertions(+), 3 deletions(-)
15
16 --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
17 +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
18 @@ -5947,7 +5947,7 @@ static int rtl8xxxu_probe(struct usb_int
19 struct ieee80211_hw *hw;
20 struct usb_device *udev;
21 struct ieee80211_supported_band *sband;
22 - int ret = 0;
23 + int ret;
24 int untested = 1;
25
26 udev = usb_get_dev(interface_to_usbdev(interface));
27 @@ -5995,6 +5995,7 @@ static int rtl8xxxu_probe(struct usb_int
28 hw = ieee80211_alloc_hw(sizeof(struct rtl8xxxu_priv), &rtl8xxxu_ops);
29 if (!hw) {
30 ret = -ENOMEM;
31 + priv = NULL;
32 goto exit;
33 }
34
35 @@ -6043,6 +6044,8 @@ static int rtl8xxxu_probe(struct usb_int
36 }
37
38 ret = rtl8xxxu_init_device(hw);
39 + if (ret)
40 + goto exit;
41
42 hw->wiphy->max_scan_ssids = 1;
43 hw->wiphy->max_scan_ie_len = IEEE80211_MAX_DATA_LEN;
44 @@ -6093,9 +6096,20 @@ static int rtl8xxxu_probe(struct usb_int
45 goto exit;
46 }
47
48 + return 0;
49 +
50 exit:
51 - if (ret < 0)
52 - usb_put_dev(udev);
53 + usb_set_intfdata(interface, NULL);
54 +
55 + if (priv) {
56 + kfree(priv->fw_data);
57 + mutex_destroy(&priv->usb_buf_mutex);
58 + mutex_destroy(&priv->h2c_mutex);
59 + }
60 + usb_put_dev(udev);
61 +
62 + ieee80211_free_hw(hw);
63 +
64 return ret;
65 }
66