Commit 646da830 authored by Tapasweni Pathak's avatar Tapasweni Pathak Committed by Greg Kroah-Hartman

staging: rtl8712: Remove unnecessary cast for argument of kfree

This patch removes all occurrences of unnecessary cast on the
argument to kfree, all over in rtl8712.

There is no need of the cast on the argument to kfree.

Greped to find occurrences.
Signed-off-by: default avatarTapasweni Pathak <tapaswenipathak@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent f999ac00
...@@ -205,12 +205,12 @@ void r8712_free_cmd_obj(struct cmd_obj *pcmd) ...@@ -205,12 +205,12 @@ void r8712_free_cmd_obj(struct cmd_obj *pcmd)
{ {
if ((pcmd->cmdcode != _JoinBss_CMD_) && if ((pcmd->cmdcode != _JoinBss_CMD_) &&
(pcmd->cmdcode != _CreateBss_CMD_)) (pcmd->cmdcode != _CreateBss_CMD_))
kfree((unsigned char *)pcmd->parmbuf); kfree(pcmd->parmbuf);
if (pcmd->rsp != NULL) { if (pcmd->rsp != NULL) {
if (pcmd->rspsz != 0) if (pcmd->rspsz != 0)
kfree((unsigned char *)pcmd->rsp); kfree(pcmd->rsp);
} }
kfree((unsigned char *)pcmd); kfree(pcmd);
} }
/* /*
...@@ -232,7 +232,7 @@ u8 r8712_sitesurvey_cmd(struct _adapter *padapter, ...@@ -232,7 +232,7 @@ u8 r8712_sitesurvey_cmd(struct _adapter *padapter,
return _FAIL; return _FAIL;
psurveyPara = kmalloc(sizeof(*psurveyPara), GFP_ATOMIC); psurveyPara = kmalloc(sizeof(*psurveyPara), GFP_ATOMIC);
if (psurveyPara == NULL) { if (psurveyPara == NULL) {
kfree((unsigned char *) ph2c); kfree(ph2c);
return _FAIL; return _FAIL;
} }
init_h2fwcmd_w_parm_no_rsp(ph2c, psurveyPara, init_h2fwcmd_w_parm_no_rsp(ph2c, psurveyPara,
...@@ -264,7 +264,7 @@ u8 r8712_setdatarate_cmd(struct _adapter *padapter, u8 *rateset) ...@@ -264,7 +264,7 @@ u8 r8712_setdatarate_cmd(struct _adapter *padapter, u8 *rateset)
return _FAIL; return _FAIL;
pbsetdataratepara = kmalloc(sizeof(*pbsetdataratepara), GFP_ATOMIC); pbsetdataratepara = kmalloc(sizeof(*pbsetdataratepara), GFP_ATOMIC);
if (pbsetdataratepara == NULL) { if (pbsetdataratepara == NULL) {
kfree((u8 *) ph2c); kfree(ph2c);
return _FAIL; return _FAIL;
} }
init_h2fwcmd_w_parm_no_rsp(ph2c, pbsetdataratepara, init_h2fwcmd_w_parm_no_rsp(ph2c, pbsetdataratepara,
...@@ -286,7 +286,7 @@ u8 r8712_set_chplan_cmd(struct _adapter *padapter, int chplan) ...@@ -286,7 +286,7 @@ u8 r8712_set_chplan_cmd(struct _adapter *padapter, int chplan)
return _FAIL; return _FAIL;
psetchplanpara = kmalloc(sizeof(*psetchplanpara), GFP_ATOMIC); psetchplanpara = kmalloc(sizeof(*psetchplanpara), GFP_ATOMIC);
if (psetchplanpara == NULL) { if (psetchplanpara == NULL) {
kfree((u8 *) ph2c); kfree(ph2c);
return _FAIL; return _FAIL;
} }
init_h2fwcmd_w_parm_no_rsp(ph2c, psetchplanpara, init_h2fwcmd_w_parm_no_rsp(ph2c, psetchplanpara,
...@@ -307,7 +307,7 @@ u8 r8712_setbasicrate_cmd(struct _adapter *padapter, u8 *rateset) ...@@ -307,7 +307,7 @@ u8 r8712_setbasicrate_cmd(struct _adapter *padapter, u8 *rateset)
return _FAIL; return _FAIL;
pssetbasicratepara = kmalloc(sizeof(*pssetbasicratepara), GFP_ATOMIC); pssetbasicratepara = kmalloc(sizeof(*pssetbasicratepara), GFP_ATOMIC);
if (pssetbasicratepara == NULL) { if (pssetbasicratepara == NULL) {
kfree((u8 *) ph2c); kfree(ph2c);
return _FAIL; return _FAIL;
} }
init_h2fwcmd_w_parm_no_rsp(ph2c, pssetbasicratepara, init_h2fwcmd_w_parm_no_rsp(ph2c, pssetbasicratepara,
...@@ -329,7 +329,7 @@ u8 r8712_setptm_cmd(struct _adapter *padapter, u8 type) ...@@ -329,7 +329,7 @@ u8 r8712_setptm_cmd(struct _adapter *padapter, u8 type)
return _FAIL; return _FAIL;
pwriteptmparm = kmalloc(sizeof(*pwriteptmparm), GFP_ATOMIC); pwriteptmparm = kmalloc(sizeof(*pwriteptmparm), GFP_ATOMIC);
if (pwriteptmparm == NULL) { if (pwriteptmparm == NULL) {
kfree((u8 *) ph2c); kfree(ph2c);
return _FAIL; return _FAIL;
} }
init_h2fwcmd_w_parm_no_rsp(ph2c, pwriteptmparm, GEN_CMD_CODE(_SetPT)); init_h2fwcmd_w_parm_no_rsp(ph2c, pwriteptmparm, GEN_CMD_CODE(_SetPT));
...@@ -349,7 +349,7 @@ u8 r8712_setfwdig_cmd(struct _adapter *padapter, u8 type) ...@@ -349,7 +349,7 @@ u8 r8712_setfwdig_cmd(struct _adapter *padapter, u8 type)
return _FAIL; return _FAIL;
pwriteptmparm = kmalloc(sizeof(*pwriteptmparm), GFP_ATOMIC); pwriteptmparm = kmalloc(sizeof(*pwriteptmparm), GFP_ATOMIC);
if (pwriteptmparm == NULL) { if (pwriteptmparm == NULL) {
kfree((u8 *) ph2c); kfree(ph2c);
return _FAIL; return _FAIL;
} }
init_h2fwcmd_w_parm_no_rsp(ph2c, pwriteptmparm, GEN_CMD_CODE(_SetDIG)); init_h2fwcmd_w_parm_no_rsp(ph2c, pwriteptmparm, GEN_CMD_CODE(_SetDIG));
...@@ -369,7 +369,7 @@ u8 r8712_setfwra_cmd(struct _adapter *padapter, u8 type) ...@@ -369,7 +369,7 @@ u8 r8712_setfwra_cmd(struct _adapter *padapter, u8 type)
return _FAIL; return _FAIL;
pwriteptmparm = kmalloc(sizeof(*pwriteptmparm), GFP_ATOMIC); pwriteptmparm = kmalloc(sizeof(*pwriteptmparm), GFP_ATOMIC);
if (pwriteptmparm == NULL) { if (pwriteptmparm == NULL) {
kfree((u8 *) ph2c); kfree(ph2c);
return _FAIL; return _FAIL;
} }
init_h2fwcmd_w_parm_no_rsp(ph2c, pwriteptmparm, GEN_CMD_CODE(_SetRA)); init_h2fwcmd_w_parm_no_rsp(ph2c, pwriteptmparm, GEN_CMD_CODE(_SetRA));
...@@ -389,7 +389,7 @@ u8 r8712_setrfreg_cmd(struct _adapter *padapter, u8 offset, u32 val) ...@@ -389,7 +389,7 @@ u8 r8712_setrfreg_cmd(struct _adapter *padapter, u8 offset, u32 val)
return _FAIL; return _FAIL;
pwriterfparm = kmalloc(sizeof(*pwriterfparm), GFP_ATOMIC); pwriterfparm = kmalloc(sizeof(*pwriterfparm), GFP_ATOMIC);
if (pwriterfparm == NULL) { if (pwriterfparm == NULL) {
kfree((u8 *) ph2c); kfree(ph2c);
return _FAIL; return _FAIL;
} }
init_h2fwcmd_w_parm_no_rsp(ph2c, pwriterfparm, GEN_CMD_CODE(_SetRFReg)); init_h2fwcmd_w_parm_no_rsp(ph2c, pwriterfparm, GEN_CMD_CODE(_SetRFReg));
...@@ -410,7 +410,7 @@ u8 r8712_getrfreg_cmd(struct _adapter *padapter, u8 offset, u8 *pval) ...@@ -410,7 +410,7 @@ u8 r8712_getrfreg_cmd(struct _adapter *padapter, u8 offset, u8 *pval)
return _FAIL; return _FAIL;
prdrfparm = kmalloc(sizeof(*prdrfparm), GFP_ATOMIC); prdrfparm = kmalloc(sizeof(*prdrfparm), GFP_ATOMIC);
if (prdrfparm == NULL) { if (prdrfparm == NULL) {
kfree((u8 *) ph2c); kfree(ph2c);
return _FAIL; return _FAIL;
} }
INIT_LIST_HEAD(&ph2c->list); INIT_LIST_HEAD(&ph2c->list);
...@@ -626,7 +626,7 @@ u8 r8712_disassoc_cmd(struct _adapter *padapter) /* for sta_mode */ ...@@ -626,7 +626,7 @@ u8 r8712_disassoc_cmd(struct _adapter *padapter) /* for sta_mode */
return _FAIL; return _FAIL;
pdisconnect = kmalloc(sizeof(*pdisconnect), GFP_ATOMIC); pdisconnect = kmalloc(sizeof(*pdisconnect), GFP_ATOMIC);
if (pdisconnect == NULL) { if (pdisconnect == NULL) {
kfree((u8 *)pdisconnect_cmd); kfree(pdisconnect_cmd);
return _FAIL; return _FAIL;
} }
init_h2fwcmd_w_parm_no_rsp(pdisconnect_cmd, pdisconnect, init_h2fwcmd_w_parm_no_rsp(pdisconnect_cmd, pdisconnect,
...@@ -648,7 +648,7 @@ u8 r8712_setopmode_cmd(struct _adapter *padapter, ...@@ -648,7 +648,7 @@ u8 r8712_setopmode_cmd(struct _adapter *padapter,
return _FAIL; return _FAIL;
psetop = kmalloc(sizeof(*psetop), GFP_ATOMIC); psetop = kmalloc(sizeof(*psetop), GFP_ATOMIC);
if (psetop == NULL) { if (psetop == NULL) {
kfree((u8 *) ph2c); kfree(ph2c);
return _FAIL; return _FAIL;
} }
init_h2fwcmd_w_parm_no_rsp(ph2c, psetop, _SetOpMode_CMD_); init_h2fwcmd_w_parm_no_rsp(ph2c, psetop, _SetOpMode_CMD_);
...@@ -672,13 +672,13 @@ u8 r8712_setstakey_cmd(struct _adapter *padapter, u8 *psta, u8 unicast_key) ...@@ -672,13 +672,13 @@ u8 r8712_setstakey_cmd(struct _adapter *padapter, u8 *psta, u8 unicast_key)
return _FAIL; return _FAIL;
psetstakey_para = kmalloc(sizeof(*psetstakey_para), GFP_ATOMIC); psetstakey_para = kmalloc(sizeof(*psetstakey_para), GFP_ATOMIC);
if (psetstakey_para == NULL) { if (psetstakey_para == NULL) {
kfree((u8 *) ph2c); kfree(ph2c);
return _FAIL; return _FAIL;
} }
psetstakey_rsp = kmalloc(sizeof(*psetstakey_rsp), GFP_ATOMIC); psetstakey_rsp = kmalloc(sizeof(*psetstakey_rsp), GFP_ATOMIC);
if (psetstakey_rsp == NULL) { if (psetstakey_rsp == NULL) {
kfree((u8 *) ph2c); kfree(ph2c);
kfree((u8 *) psetstakey_para); kfree(psetstakey_para);
return _FAIL; return _FAIL;
} }
init_h2fwcmd_w_parm_no_rsp(ph2c, psetstakey_para, _SetStaKey_CMD_); init_h2fwcmd_w_parm_no_rsp(ph2c, psetstakey_para, _SetStaKey_CMD_);
...@@ -712,7 +712,7 @@ u8 r8712_setrfintfs_cmd(struct _adapter *padapter, u8 mode) ...@@ -712,7 +712,7 @@ u8 r8712_setrfintfs_cmd(struct _adapter *padapter, u8 mode)
return _FAIL; return _FAIL;
psetrfintfsparm = kmalloc(sizeof(*psetrfintfsparm), GFP_ATOMIC); psetrfintfsparm = kmalloc(sizeof(*psetrfintfsparm), GFP_ATOMIC);
if (psetrfintfsparm == NULL) { if (psetrfintfsparm == NULL) {
kfree((unsigned char *) ph2c); kfree(ph2c);
return _FAIL; return _FAIL;
} }
init_h2fwcmd_w_parm_no_rsp(ph2c, psetrfintfsparm, init_h2fwcmd_w_parm_no_rsp(ph2c, psetrfintfsparm,
...@@ -734,7 +734,7 @@ u8 r8712_setrttbl_cmd(struct _adapter *padapter, ...@@ -734,7 +734,7 @@ u8 r8712_setrttbl_cmd(struct _adapter *padapter,
return _FAIL; return _FAIL;
psetrttblparm = kmalloc(sizeof(*psetrttblparm), GFP_ATOMIC); psetrttblparm = kmalloc(sizeof(*psetrttblparm), GFP_ATOMIC);
if (psetrttblparm == NULL) { if (psetrttblparm == NULL) {
kfree((unsigned char *)ph2c); kfree(ph2c);
return _FAIL; return _FAIL;
} }
init_h2fwcmd_w_parm_no_rsp(ph2c, psetrttblparm, init_h2fwcmd_w_parm_no_rsp(ph2c, psetrttblparm,
...@@ -755,7 +755,7 @@ u8 r8712_gettssi_cmd(struct _adapter *padapter, u8 offset, u8 *pval) ...@@ -755,7 +755,7 @@ u8 r8712_gettssi_cmd(struct _adapter *padapter, u8 offset, u8 *pval)
return _FAIL; return _FAIL;
prdtssiparm = kmalloc(sizeof(*prdtssiparm), GFP_ATOMIC); prdtssiparm = kmalloc(sizeof(*prdtssiparm), GFP_ATOMIC);
if (prdtssiparm == NULL) { if (prdtssiparm == NULL) {
kfree((unsigned char *) ph2c); kfree(ph2c);
return _FAIL; return _FAIL;
} }
INIT_LIST_HEAD(&ph2c->list); INIT_LIST_HEAD(&ph2c->list);
...@@ -781,7 +781,7 @@ u8 r8712_setMacAddr_cmd(struct _adapter *padapter, u8 *mac_addr) ...@@ -781,7 +781,7 @@ u8 r8712_setMacAddr_cmd(struct _adapter *padapter, u8 *mac_addr)
return _FAIL; return _FAIL;
psetMacAddr_para = kmalloc(sizeof(*psetMacAddr_para), GFP_ATOMIC); psetMacAddr_para = kmalloc(sizeof(*psetMacAddr_para), GFP_ATOMIC);
if (psetMacAddr_para == NULL) { if (psetMacAddr_para == NULL) {
kfree((u8 *) ph2c); kfree(ph2c);
return _FAIL; return _FAIL;
} }
init_h2fwcmd_w_parm_no_rsp(ph2c, psetMacAddr_para, init_h2fwcmd_w_parm_no_rsp(ph2c, psetMacAddr_para,
...@@ -803,13 +803,13 @@ u8 r8712_setassocsta_cmd(struct _adapter *padapter, u8 *mac_addr) ...@@ -803,13 +803,13 @@ u8 r8712_setassocsta_cmd(struct _adapter *padapter, u8 *mac_addr)
return _FAIL; return _FAIL;
psetassocsta_para = kmalloc(sizeof(*psetassocsta_para), GFP_ATOMIC); psetassocsta_para = kmalloc(sizeof(*psetassocsta_para), GFP_ATOMIC);
if (psetassocsta_para == NULL) { if (psetassocsta_para == NULL) {
kfree((u8 *) ph2c); kfree(ph2c);
return _FAIL; return _FAIL;
} }
psetassocsta_rsp = kmalloc(sizeof(*psetassocsta_rsp), GFP_ATOMIC); psetassocsta_rsp = kmalloc(sizeof(*psetassocsta_rsp), GFP_ATOMIC);
if (psetassocsta_rsp == NULL) { if (psetassocsta_rsp == NULL) {
kfree((u8 *)ph2c); kfree(ph2c);
kfree((u8 *)psetassocsta_para); kfree(psetassocsta_para);
return _FAIL; return _FAIL;
} }
init_h2fwcmd_w_parm_no_rsp(ph2c, psetassocsta_para, _SetAssocSta_CMD_); init_h2fwcmd_w_parm_no_rsp(ph2c, psetassocsta_para, _SetAssocSta_CMD_);
...@@ -831,7 +831,7 @@ u8 r8712_addbareq_cmd(struct _adapter *padapter, u8 tid) ...@@ -831,7 +831,7 @@ u8 r8712_addbareq_cmd(struct _adapter *padapter, u8 tid)
return _FAIL; return _FAIL;
paddbareq_parm = kmalloc(sizeof(*paddbareq_parm), GFP_ATOMIC); paddbareq_parm = kmalloc(sizeof(*paddbareq_parm), GFP_ATOMIC);
if (paddbareq_parm == NULL) { if (paddbareq_parm == NULL) {
kfree((unsigned char *)ph2c); kfree(ph2c);
return _FAIL; return _FAIL;
} }
paddbareq_parm->tid = tid; paddbareq_parm->tid = tid;
...@@ -852,7 +852,7 @@ u8 r8712_wdg_wk_cmd(struct _adapter *padapter) ...@@ -852,7 +852,7 @@ u8 r8712_wdg_wk_cmd(struct _adapter *padapter)
return _FAIL; return _FAIL;
pdrvintcmd_param = kmalloc(sizeof(*pdrvintcmd_param), GFP_ATOMIC); pdrvintcmd_param = kmalloc(sizeof(*pdrvintcmd_param), GFP_ATOMIC);
if (pdrvintcmd_param == NULL) { if (pdrvintcmd_param == NULL) {
kfree((unsigned char *)ph2c); kfree(ph2c);
return _FAIL; return _FAIL;
} }
pdrvintcmd_param->i_cid = WDG_WK_CID; pdrvintcmd_param->i_cid = WDG_WK_CID;
...@@ -1026,7 +1026,7 @@ u8 r8712_disconnectCtrlEx_cmd(struct _adapter *adapter, u32 enableDrvCtrl, ...@@ -1026,7 +1026,7 @@ u8 r8712_disconnectCtrlEx_cmd(struct _adapter *adapter, u32 enableDrvCtrl,
return _FAIL; return _FAIL;
param = kzalloc(sizeof(*param), GFP_ATOMIC); param = kzalloc(sizeof(*param), GFP_ATOMIC);
if (param == NULL) { if (param == NULL) {
kfree((unsigned char *) ph2c); kfree(ph2c);
return _FAIL; return _FAIL;
} }
......
...@@ -142,7 +142,7 @@ uint r8712_alloc_io_queue(struct _adapter *adapter) ...@@ -142,7 +142,7 @@ uint r8712_alloc_io_queue(struct _adapter *adapter)
alloc_io_queue_fail: alloc_io_queue_fail:
if (pio_queue) { if (pio_queue) {
kfree(pio_queue->pallocated_free_ioreqs_buf); kfree(pio_queue->pallocated_free_ioreqs_buf);
kfree((u8 *)pio_queue); kfree(pio_queue);
} }
adapter->pio_queue = NULL; adapter->pio_queue = NULL;
return _FAIL; return _FAIL;
...@@ -156,6 +156,6 @@ void r8712_free_io_queue(struct _adapter *adapter) ...@@ -156,6 +156,6 @@ void r8712_free_io_queue(struct _adapter *adapter)
kfree(pio_queue->pallocated_free_ioreqs_buf); kfree(pio_queue->pallocated_free_ioreqs_buf);
adapter->pio_queue = NULL; adapter->pio_queue = NULL;
unregister_intf_hdl(&pio_queue->intf); unregister_intf_hdl(&pio_queue->intf);
kfree((u8 *)pio_queue); kfree(pio_queue);
} }
} }
...@@ -505,7 +505,7 @@ static int wpa_set_encryption(struct net_device *dev, struct ieee_param *param, ...@@ -505,7 +505,7 @@ static int wpa_set_encryption(struct net_device *dev, struct ieee_param *param,
} }
} }
exit: exit:
kfree((u8 *)pwep); kfree(pwep);
return ret; return ret;
} }
...@@ -2216,7 +2216,7 @@ static int wpa_supplicant_ioctl(struct net_device *dev, struct iw_point *p) ...@@ -2216,7 +2216,7 @@ static int wpa_supplicant_ioctl(struct net_device *dev, struct iw_point *p)
} }
if (ret == 0 && copy_to_user(p->pointer, param, p->length)) if (ret == 0 && copy_to_user(p->pointer, param, p->length))
ret = -EFAULT; ret = -EFAULT;
kfree((u8 *)param); kfree(param);
return ret; return ret;
} }
......
...@@ -923,7 +923,7 @@ void r8712_joinbss_event_callback(struct _adapter *adapter, u8 *pbuf) ...@@ -923,7 +923,7 @@ void r8712_joinbss_event_callback(struct _adapter *adapter, u8 *pbuf)
ignore_joinbss_callback: ignore_joinbss_callback:
spin_unlock_irqrestore(&pmlmepriv->lock, irqL); spin_unlock_irqrestore(&pmlmepriv->lock, irqL);
if (sizeof(struct list_head) == 4 * sizeof(u32)) if (sizeof(struct list_head) == 4 * sizeof(u32))
kfree((u8 *)pnetwork); kfree(pnetwork);
} }
void r8712_stassoc_event_callback(struct _adapter *adapter, u8 *pbuf) void r8712_stassoc_event_callback(struct _adapter *adapter, u8 *pbuf)
...@@ -1218,7 +1218,7 @@ sint r8712_set_auth(struct _adapter *adapter, ...@@ -1218,7 +1218,7 @@ sint r8712_set_auth(struct _adapter *adapter,
psetauthparm = kzalloc(sizeof(*psetauthparm), GFP_ATOMIC); psetauthparm = kzalloc(sizeof(*psetauthparm), GFP_ATOMIC);
if (psetauthparm == NULL) { if (psetauthparm == NULL) {
kfree((unsigned char *)pcmd); kfree(pcmd);
return _FAIL; return _FAIL;
} }
psetauthparm->mode = (u8)psecuritypriv->AuthAlgrthm; psetauthparm->mode = (u8)psecuritypriv->AuthAlgrthm;
......
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