Commit 29e20dd4 authored by Ivan Safonov's avatar Ivan Safonov Committed by Greg Kroah-Hartman

staging: rtl8188eu: remove pfirmware and fwsize of the hal_data_8188e structure

The pfirmware is used only in rtl88eu_download_fw function
(except the kfree(rtlhal->pfirmware) in netdev_close).

The fwsize not used after initialization at all.

The pfirmvare replaced by fw_data and fwsize removed.
Signed-off-by: default avatarIvan Safonov <insafonov@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent f643ba69
...@@ -158,13 +158,12 @@ static int _rtl88e_fw_free_to_go(struct adapter *adapt) ...@@ -158,13 +158,12 @@ static int _rtl88e_fw_free_to_go(struct adapter *adapt)
int rtl88eu_download_fw(struct adapter *adapt) int rtl88eu_download_fw(struct adapter *adapt)
{ {
struct hal_data_8188e *rtlhal = GET_HAL_DATA(adapt);
struct dvobj_priv *dvobj = adapter_to_dvobj(adapt); struct dvobj_priv *dvobj = adapter_to_dvobj(adapt);
struct device *device = dvobj_to_dev(dvobj); struct device *device = dvobj_to_dev(dvobj);
const struct firmware *fw; const struct firmware *fw;
const char fw_name[] = "rtlwifi/rtl8188eufw.bin"; const char fw_name[] = "rtlwifi/rtl8188eufw.bin";
struct rtl92c_firmware_header *pfwheader = NULL; struct rtl92c_firmware_header *pfwheader = NULL;
u8 *download_data; u8 *download_data, *fw_data;
size_t download_size; size_t download_size;
unsigned int trailing_zeros_length; unsigned int trailing_zeros_length;
...@@ -181,22 +180,20 @@ int rtl88eu_download_fw(struct adapter *adapt) ...@@ -181,22 +180,20 @@ int rtl88eu_download_fw(struct adapter *adapt)
trailing_zeros_length = (4 - fw->size % 4) % 4; trailing_zeros_length = (4 - fw->size % 4) % 4;
rtlhal->fwsize = fw->size; fw_data = kmalloc(fw->size + trailing_zeros_length, GFP_KERNEL);
rtlhal->pfirmware = kmalloc(fw->size + trailing_zeros_length, if (!fw_data)
GFP_KERNEL);
if (!rtlhal->pfirmware)
return -ENOMEM; return -ENOMEM;
memcpy(rtlhal->pfirmware, fw->data, fw->size); memcpy(fw_data, fw->data, fw->size);
memset(rtlhal->pfirmware + fw->size, 0, trailing_zeros_length); memset(fw_data + fw->size, 0, trailing_zeros_length);
pfwheader = (struct rtl92c_firmware_header *)rtlhal->pfirmware; pfwheader = (struct rtl92c_firmware_header *)fw_data;
if (IS_FW_HEADER_EXIST(pfwheader)) { if (IS_FW_HEADER_EXIST(pfwheader)) {
download_data = rtlhal->pfirmware + 32; download_data = fw_data + 32;
download_size = fw->size + trailing_zeros_length - 32; download_size = fw->size + trailing_zeros_length - 32;
} else { } else {
download_data = rtlhal->pfirmware; download_data = fw_data;
download_size = fw->size + trailing_zeros_length; download_size = fw->size + trailing_zeros_length;
} }
...@@ -211,5 +208,6 @@ int rtl88eu_download_fw(struct adapter *adapt) ...@@ -211,5 +208,6 @@ int rtl88eu_download_fw(struct adapter *adapt)
_rtl88e_write_fw(adapt, download_data, download_size); _rtl88e_write_fw(adapt, download_data, download_size);
_rtl88e_enable_fw_download(adapt, false); _rtl88e_enable_fw_download(adapt, false);
kfree(fw_data);
return _rtl88e_fw_free_to_go(adapt); return _rtl88e_fw_free_to_go(adapt);
} }
...@@ -191,8 +191,6 @@ struct txpowerinfo24g { ...@@ -191,8 +191,6 @@ struct txpowerinfo24g {
struct hal_data_8188e { struct hal_data_8188e {
struct HAL_VERSION VersionID; struct HAL_VERSION VersionID;
u16 CustomerID; u16 CustomerID;
u8 *pfirmware;
u32 fwsize;
u16 FirmwareVersion; u16 FirmwareVersion;
u16 FirmwareVersionRev; u16 FirmwareVersionRev;
u16 FirmwareSubVersion; u16 FirmwareSubVersion;
......
...@@ -1155,7 +1155,6 @@ int pm_netdev_open(struct net_device *pnetdev, u8 bnormal) ...@@ -1155,7 +1155,6 @@ int pm_netdev_open(struct net_device *pnetdev, u8 bnormal)
static int netdev_close(struct net_device *pnetdev) static int netdev_close(struct net_device *pnetdev)
{ {
struct adapter *padapter = (struct adapter *)rtw_netdev_priv(pnetdev); struct adapter *padapter = (struct adapter *)rtw_netdev_priv(pnetdev);
struct hal_data_8188e *rtlhal = GET_HAL_DATA(padapter);
RT_TRACE(_module_os_intfs_c_, _drv_info_, ("+88eu_drv - drv_close\n")); RT_TRACE(_module_os_intfs_c_, _drv_info_, ("+88eu_drv - drv_close\n"));
...@@ -1188,9 +1187,6 @@ static int netdev_close(struct net_device *pnetdev) ...@@ -1188,9 +1187,6 @@ static int netdev_close(struct net_device *pnetdev)
rtw_led_control(padapter, LED_CTL_POWER_OFF); rtw_led_control(padapter, LED_CTL_POWER_OFF);
} }
kfree(rtlhal->pfirmware);
rtlhal->pfirmware = NULL;
RT_TRACE(_module_os_intfs_c_, _drv_info_, ("-88eu_drv - drv_close\n")); RT_TRACE(_module_os_intfs_c_, _drv_info_, ("-88eu_drv - drv_close\n"));
DBG_88E("-88eu_drv - drv_close, bup =%d\n", padapter->bup); DBG_88E("-88eu_drv - drv_close, bup =%d\n", padapter->bup);
return 0; return 0;
......
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