rtlwifi: rtl8188ee: rtl8723ae: rtl8821ae: Initialize some variables
authorLarry Finger <Larry.Finger@lwfinger.net>
Fri, 26 Sep 2014 21:40:28 +0000 (16:40 -0500)
committerJohn W. Linville <linville@tuxdriver.com>
Tue, 30 Sep 2014 17:17:38 +0000 (13:17 -0400)
In a number of places, kmalloc or valloc were used to acquire memory.
To ensure that these locations are correctly initialized, the calls were
changed to kzalloc and vzalloc. The change fixes a problem that was causing
HT operations to be cancelled.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/rtlwifi/efuse.c
drivers/net/wireless/rtlwifi/pci.c
drivers/net/wireless/rtlwifi/rtl8188ee/sw.c
drivers/net/wireless/rtlwifi/rtl8723ae/hal_btc.c
drivers/net/wireless/rtlwifi/rtl8723ae/sw.c
drivers/net/wireless/rtlwifi/rtl8821ae/sw.c
drivers/net/wireless/rtlwifi/usb.c

index 118293b631cdd498f8bf816626db734a3fdd2e7a..0b4082c9272a12e36063b3b5e951e48d49944952 100644 (file)
@@ -251,7 +251,7 @@ void read_efuse(struct ieee80211_hw *hw, u16 _offset, u16 _size_byte, u8 *pbuf)
        }
 
        /* allocate memory for efuse_tbl and efuse_word */
-       efuse_tbl = kmalloc(rtlpriv->cfg->maps[EFUSE_HWSET_MAX_SIZE] *
+       efuse_tbl = kzalloc(rtlpriv->cfg->maps[EFUSE_HWSET_MAX_SIZE] *
                            sizeof(u8), GFP_ATOMIC);
        if (!efuse_tbl)
                return;
@@ -259,7 +259,7 @@ void read_efuse(struct ieee80211_hw *hw, u16 _offset, u16 _size_byte, u8 *pbuf)
        if (!efuse_word)
                goto out;
        for (i = 0; i < EFUSE_MAX_WORD_UNIT; i++) {
-               efuse_word[i] = kmalloc(efuse_max_section * sizeof(u16),
+               efuse_word[i] = kzalloc(efuse_max_section * sizeof(u16),
                                        GFP_ATOMIC);
                if (!efuse_word[i])
                        goto done;
index 1dbb22b537ef2d3325005d7ef9a903563b04ab87..667aba81246c9ac094db11a5c455be9c29d273ad 100644 (file)
@@ -2243,16 +2243,6 @@ int rtl_pci_probe(struct pci_dev *pdev,
        /*like read eeprom and so on */
        rtlpriv->cfg->ops->read_eeprom_info(hw);
 
-       if (rtlpriv->cfg->ops->init_sw_vars(hw)) {
-               RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, "Can't init_sw_vars\n");
-               err = -ENODEV;
-               goto fail3;
-       }
-       rtlpriv->cfg->ops->init_sw_leds(hw);
-
-       /*aspm */
-       rtl_pci_init_aspm(hw);
-
        /* Init mac80211 sw */
        err = rtl_init_core(hw);
        if (err) {
@@ -2268,6 +2258,16 @@ int rtl_pci_probe(struct pci_dev *pdev,
                goto fail3;
        }
 
+       if (rtlpriv->cfg->ops->init_sw_vars(hw)) {
+               RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, "Can't init_sw_vars\n");
+               err = -ENODEV;
+               goto fail3;
+       }
+       rtlpriv->cfg->ops->init_sw_leds(hw);
+
+       /*aspm */
+       rtl_pci_init_aspm(hw);
+
        err = ieee80211_register_hw(hw);
        if (err) {
                RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
index ab7dbfb2623f96fd004035be7855c29260b6ef86..11344121c55e072f4a1e5788d24202971e565cc4 100644 (file)
@@ -159,7 +159,7 @@ int rtl88e_init_sw_vars(struct ieee80211_hw *hw)
                rtlpriv->psc.fwctrl_psmode = FW_PS_DTIM_MODE;
 
        /* for firmware buf */
-       rtlpriv->rtlhal.pfirmware = vmalloc(0x8000);
+       rtlpriv->rtlhal.pfirmware = vzalloc(0x8000);
        if (!rtlpriv->rtlhal.pfirmware) {
                RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
                         "Can't alloc buffer for fw.\n");
index 747958abd256d7b2106fd33ec2c5f814ac52e098..00a0531cc5f49a84637f222332a58450ec118ef9 100644 (file)
@@ -1735,7 +1735,7 @@ void rtl_8723e_c2h_command_handle(struct ieee80211_hw *hw)
                rtl_write_byte(rtlpriv, 0x1AF, 0x00);
                return;
        }
-       ptmp_buf = kmalloc(c2h_event.cmd_len, GFP_KERNEL);
+       ptmp_buf = kzalloc(c2h_event.cmd_len, GFP_KERNEL);
        if (ptmp_buf == NULL) {
                RT_TRACE(rtlpriv, COMP_FW, DBG_TRACE,
                         "malloc cmd buf failed\n");
index d8f8cc49a4308832ad3806546ec1a4d66b30bae3..8280bab43df4ce47755a1ab545e8dc2cf5aad086 100644 (file)
@@ -164,7 +164,7 @@ int rtl8723e_init_sw_vars(struct ieee80211_hw *hw)
                rtlpriv->psc.fwctrl_psmode = FW_PS_DTIM_MODE;
 
        /* for firmware buf */
-       rtlpriv->rtlhal.pfirmware = vmalloc(0x6000);
+       rtlpriv->rtlhal.pfirmware = vzalloc(0x6000);
        if (!rtlpriv->rtlhal.pfirmware) {
                RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
                         "Can't alloc buffer for fw.\n");
index 3cf7557b7786768a7ec922dbd083b139b9c44202..fc92dd6a0d078bf107f461a660b2ca5d3cf03e71 100644 (file)
@@ -95,7 +95,7 @@ static void load_wowlan_fw(struct rtl_priv *rtlpriv)
        int err;
 
        /* for wowlan firmware buf */
-       rtlpriv->rtlhal.wowlan_firmware = vmalloc(0x8000);
+       rtlpriv->rtlhal.wowlan_firmware = vzalloc(0x8000);
        if (!rtlpriv->rtlhal.wowlan_firmware) {
                RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
                         "Can't alloc buffer for wowlan fw.\n");
index 0398d3ea15b00b6c68b4b1e160700df276f90254..10cf69c4bc42ea93adefdab5569cbe90a19a4a63 100644 (file)
@@ -75,11 +75,11 @@ static int _usbctrl_vendorreq_async_write(struct usb_device *udev, u8 request,
        pipe = usb_sndctrlpipe(udev, 0); /* write_out */
        reqtype =  REALTEK_USB_VENQT_WRITE;
 
-       dr = kmalloc(sizeof(*dr), GFP_ATOMIC);
+       dr = kzalloc(sizeof(*dr), GFP_ATOMIC);
        if (!dr)
                return -ENOMEM;
 
-       databuf = kmalloc(databuf_maxlen, GFP_ATOMIC);
+       databuf = kzalloc(databuf_maxlen, GFP_ATOMIC);
        if (!databuf) {
                kfree(dr);
                return -ENOMEM;