Commit ef09396e authored by Larry Finger's avatar Larry Finger Committed by John W. Linville

rtlwifi: rtl8188ee: rtl8723ae: rtl8821ae: Initialize some variables

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: default avatarLarry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 557f9331
...@@ -251,7 +251,7 @@ void read_efuse(struct ieee80211_hw *hw, u16 _offset, u16 _size_byte, u8 *pbuf) ...@@ -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 */ /* 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); sizeof(u8), GFP_ATOMIC);
if (!efuse_tbl) if (!efuse_tbl)
return; return;
...@@ -259,7 +259,7 @@ void read_efuse(struct ieee80211_hw *hw, u16 _offset, u16 _size_byte, u8 *pbuf) ...@@ -259,7 +259,7 @@ void read_efuse(struct ieee80211_hw *hw, u16 _offset, u16 _size_byte, u8 *pbuf)
if (!efuse_word) if (!efuse_word)
goto out; goto out;
for (i = 0; i < EFUSE_MAX_WORD_UNIT; i++) { 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); GFP_ATOMIC);
if (!efuse_word[i]) if (!efuse_word[i])
goto done; goto done;
......
...@@ -2243,16 +2243,6 @@ int rtl_pci_probe(struct pci_dev *pdev, ...@@ -2243,16 +2243,6 @@ int rtl_pci_probe(struct pci_dev *pdev,
/*like read eeprom and so on */ /*like read eeprom and so on */
rtlpriv->cfg->ops->read_eeprom_info(hw); 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 */ /* Init mac80211 sw */
err = rtl_init_core(hw); err = rtl_init_core(hw);
if (err) { if (err) {
...@@ -2268,6 +2258,16 @@ int rtl_pci_probe(struct pci_dev *pdev, ...@@ -2268,6 +2258,16 @@ int rtl_pci_probe(struct pci_dev *pdev,
goto fail3; 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); err = ieee80211_register_hw(hw);
if (err) { if (err) {
RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
......
...@@ -159,7 +159,7 @@ int rtl88e_init_sw_vars(struct ieee80211_hw *hw) ...@@ -159,7 +159,7 @@ int rtl88e_init_sw_vars(struct ieee80211_hw *hw)
rtlpriv->psc.fwctrl_psmode = FW_PS_DTIM_MODE; rtlpriv->psc.fwctrl_psmode = FW_PS_DTIM_MODE;
/* for firmware buf */ /* for firmware buf */
rtlpriv->rtlhal.pfirmware = vmalloc(0x8000); rtlpriv->rtlhal.pfirmware = vzalloc(0x8000);
if (!rtlpriv->rtlhal.pfirmware) { if (!rtlpriv->rtlhal.pfirmware) {
RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
"Can't alloc buffer for fw.\n"); "Can't alloc buffer for fw.\n");
......
...@@ -1735,7 +1735,7 @@ void rtl_8723e_c2h_command_handle(struct ieee80211_hw *hw) ...@@ -1735,7 +1735,7 @@ void rtl_8723e_c2h_command_handle(struct ieee80211_hw *hw)
rtl_write_byte(rtlpriv, 0x1AF, 0x00); rtl_write_byte(rtlpriv, 0x1AF, 0x00);
return; return;
} }
ptmp_buf = kmalloc(c2h_event.cmd_len, GFP_KERNEL); ptmp_buf = kzalloc(c2h_event.cmd_len, GFP_KERNEL);
if (ptmp_buf == NULL) { if (ptmp_buf == NULL) {
RT_TRACE(rtlpriv, COMP_FW, DBG_TRACE, RT_TRACE(rtlpriv, COMP_FW, DBG_TRACE,
"malloc cmd buf failed\n"); "malloc cmd buf failed\n");
......
...@@ -164,7 +164,7 @@ int rtl8723e_init_sw_vars(struct ieee80211_hw *hw) ...@@ -164,7 +164,7 @@ int rtl8723e_init_sw_vars(struct ieee80211_hw *hw)
rtlpriv->psc.fwctrl_psmode = FW_PS_DTIM_MODE; rtlpriv->psc.fwctrl_psmode = FW_PS_DTIM_MODE;
/* for firmware buf */ /* for firmware buf */
rtlpriv->rtlhal.pfirmware = vmalloc(0x6000); rtlpriv->rtlhal.pfirmware = vzalloc(0x6000);
if (!rtlpriv->rtlhal.pfirmware) { if (!rtlpriv->rtlhal.pfirmware) {
RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
"Can't alloc buffer for fw.\n"); "Can't alloc buffer for fw.\n");
......
...@@ -95,7 +95,7 @@ static void load_wowlan_fw(struct rtl_priv *rtlpriv) ...@@ -95,7 +95,7 @@ static void load_wowlan_fw(struct rtl_priv *rtlpriv)
int err; int err;
/* for wowlan firmware buf */ /* for wowlan firmware buf */
rtlpriv->rtlhal.wowlan_firmware = vmalloc(0x8000); rtlpriv->rtlhal.wowlan_firmware = vzalloc(0x8000);
if (!rtlpriv->rtlhal.wowlan_firmware) { if (!rtlpriv->rtlhal.wowlan_firmware) {
RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
"Can't alloc buffer for wowlan fw.\n"); "Can't alloc buffer for wowlan fw.\n");
......
...@@ -75,11 +75,11 @@ static int _usbctrl_vendorreq_async_write(struct usb_device *udev, u8 request, ...@@ -75,11 +75,11 @@ static int _usbctrl_vendorreq_async_write(struct usb_device *udev, u8 request,
pipe = usb_sndctrlpipe(udev, 0); /* write_out */ pipe = usb_sndctrlpipe(udev, 0); /* write_out */
reqtype = REALTEK_USB_VENQT_WRITE; reqtype = REALTEK_USB_VENQT_WRITE;
dr = kmalloc(sizeof(*dr), GFP_ATOMIC); dr = kzalloc(sizeof(*dr), GFP_ATOMIC);
if (!dr) if (!dr)
return -ENOMEM; return -ENOMEM;
databuf = kmalloc(databuf_maxlen, GFP_ATOMIC); databuf = kzalloc(databuf_maxlen, GFP_ATOMIC);
if (!databuf) { if (!databuf) {
kfree(dr); kfree(dr);
return -ENOMEM; return -ENOMEM;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment