OSDN Git Service

staging: rtl8723bs: core: Remove typecast in call to kfree
authorNachammai Karuppiah <nachukannan@gmail.com>
Tue, 8 Oct 2019 20:17:38 +0000 (13:17 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 10 Oct 2019 08:51:09 +0000 (10:51 +0200)
Remove typecast in the call to kfree as it is not needed.
Issue found using the below coccinelle script with options -I and
--recursive-includes,

@@
type t1;
expression *e;
@@

-kfree((t1 *)e);
+kfree(e);

Signed-off-by: Nachammai Karuppiah <nachukannan@gmail.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Link: https://lore.kernel.org/r/1570565858-91737-1-git-send-email-nachukannan@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/rtl8723bs/core/rtw_ap.c
drivers/staging/rtl8723bs/core/rtw_cmd.c
drivers/staging/rtl8723bs/core/rtw_mlme.c
drivers/staging/rtl8723bs/core/rtw_wlan_util.c
drivers/staging/rtl8723bs/core/rtw_xmit.c

index 6d18d23..a1f5016 100644 (file)
@@ -1453,7 +1453,7 @@ u8 rtw_ap_set_pairwise_key(struct adapter *padapter, struct sta_info *psta)
 
        psetstakey_para = rtw_zmalloc(sizeof(struct set_stakey_parm));
        if (psetstakey_para == NULL) {
-               kfree((u8 *)ph2c);
+               kfree(ph2c);
                res = _FAIL;
                goto exit;
        }
@@ -1496,7 +1496,7 @@ static int rtw_ap_set_key(
        }
        psetkeyparm = rtw_zmalloc(sizeof(struct setkey_parm));
        if (psetkeyparm == NULL) {
-               kfree((unsigned char *)pcmd);
+               kfree(pcmd);
                res = _FAIL;
                goto exit;
        }
index 8d93c2f..e6fea96 100644 (file)
@@ -372,13 +372,13 @@ void rtw_free_cmd_obj(struct cmd_obj *pcmd)
        if ((pcmd->cmdcode != _JoinBss_CMD_) &&
            (pcmd->cmdcode != _CreateBss_CMD_)) {
                /* free parmbuf in cmd_obj */
-               kfree((unsigned char *)pcmd->parmbuf);
+               kfree(pcmd->parmbuf);
        }
 
        if (pcmd->rsp != NULL) {
                if (pcmd->rspsz != 0) {
                        /* free rsp in cmd_obj */
-                       kfree((unsigned char *)pcmd->rsp);
+                       kfree(pcmd->rsp);
                }
        }
 
index 0ac7712..1b29a20 100644 (file)
@@ -2207,7 +2207,7 @@ sint rtw_set_auth(struct adapter *adapter, struct security_priv *psecuritypriv)
 
        psetauthparm = rtw_zmalloc(sizeof(struct setauth_parm));
        if (psetauthparm == NULL) {
-               kfree((unsigned char *)pcmd);
+               kfree(pcmd);
                res = _FAIL;
                goto exit;
        }
@@ -2284,7 +2284,7 @@ sint rtw_set_key(struct adapter *adapter, struct security_priv *psecuritypriv, s
        default:
                RT_TRACE(_module_rtl871x_mlme_c_, _drv_err_, ("\n rtw_set_key:psecuritypriv->dot11PrivacyAlgrthm = %x (must be 1 or 2 or 4 or 5)\n", psecuritypriv->dot11PrivacyAlgrthm));
                res = _FAIL;
-               kfree((unsigned char *)psetkeyparm);
+               kfree(psetkeyparm);
                goto exit;
        }
 
@@ -2292,7 +2292,7 @@ sint rtw_set_key(struct adapter *adapter, struct security_priv *psecuritypriv, s
        if (enqueue) {
                pcmd = rtw_zmalloc(sizeof(struct cmd_obj));
                if (pcmd == NULL) {
-                       kfree((unsigned char *)psetkeyparm);
+                       kfree(psetkeyparm);
                        res = _FAIL;  /* try again */
                        goto exit;
                }
@@ -2308,7 +2308,7 @@ sint rtw_set_key(struct adapter *adapter, struct security_priv *psecuritypriv, s
                res = rtw_enqueue_cmd(pcmdpriv, pcmd);
        } else {
                setkey_hdl(adapter, (u8 *)psetkeyparm);
-               kfree((u8 *) psetkeyparm);
+               kfree(psetkeyparm);
        }
 exit:
        return res;
index 3933e86..9590e6f 100644 (file)
@@ -1466,11 +1466,11 @@ int rtw_check_bcn_info(struct adapter *Adapter, u8 *pframe, u32 packet_len)
                }
        }
 
-       kfree((u8 *)bssid);
+       kfree(bssid);
        return _SUCCESS;
 
 _mismatch:
-       kfree((u8 *)bssid);
+       kfree(bssid);
 
        if (pmlmepriv->NumOfBcnInfoChkFail == 0)
                pmlmepriv->timeBcnInfoChkStart = jiffies;
index 43d663c..f5cb5ae 100644 (file)
@@ -2212,7 +2212,7 @@ void rtw_free_hwxmits(struct adapter *padapter)
 
        hwxmits = pxmitpriv->hwxmits;
        if (hwxmits)
-               kfree((u8 *)hwxmits);
+               kfree(hwxmits);
 }
 
 void rtw_init_hwxmits(struct hw_xmit *phwxmit, sint entry)