aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/rtl8712/rtl871x_mlme.c
diff options
context:
space:
mode:
authorVitaly Osipov <vitaly.osipov@gmail.com>2014-05-24 18:19:27 +1000
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-05-25 11:04:44 -0700
commit91d435fe368ab30702d7bcd50f680e7185899295 (patch)
tree2415c6d2ad015124be711c82499e0affd6ef89fb /drivers/staging/rtl8712/rtl871x_mlme.c
parentstaging: slicoss: clean up use of dev_err (diff)
downloadlinux-dev-91d435fe368ab30702d7bcd50f680e7185899295.tar.xz
linux-dev-91d435fe368ab30702d7bcd50f680e7185899295.zip
staging: rtl8712: remove _malloc()
This patch removes all usage of _malloc() and the function itself. Most uses are straightforward replacements by kmalloc(..., GFP_ATOMIC), because this was the definition of _malloc(). In a few places it was possible to use kzalloc() or memdup_user. A further improvement would be to replace GFP_ATOMIC with GFP_KERNEL where possible. Verified by compilation only. Initial replacement done by running a Coccinelle script along the lines of: @@ type T; expression E; identifier V; @@ - V = (T) _malloc(E); + V = kmalloc(E, GFP_ATOMIC); @@ expression E, E1; @@ - E1 = _malloc(E); + E1 = kmalloc(E, GFP_ATOMIC); Signed-off-by: Vitaly Osipov <vitaly.osipov@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/rtl8712/rtl871x_mlme.c')
-rw-r--r--drivers/staging/rtl8712/rtl871x_mlme.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/drivers/staging/rtl8712/rtl871x_mlme.c b/drivers/staging/rtl8712/rtl871x_mlme.c
index f8f651a9d7b0..02339e100014 100644
--- a/drivers/staging/rtl8712/rtl871x_mlme.c
+++ b/drivers/staging/rtl8712/rtl871x_mlme.c
@@ -62,7 +62,8 @@ static sint _init_mlme_priv(struct _adapter *padapter)
_init_queue(&(pmlmepriv->scanned_queue));
set_scanned_network_val(pmlmepriv, 0);
memset(&pmlmepriv->assoc_ssid, 0, sizeof(struct ndis_802_11_ssid));
- pbuf = _malloc(MAX_BSS_CNT * (sizeof(struct wlan_network)));
+ pbuf = kmalloc(MAX_BSS_CNT * (sizeof(struct wlan_network)),
+ GFP_ATOMIC);
if (pbuf == NULL)
return _FAIL;
pmlmepriv->free_bss_buf = pbuf;
@@ -725,8 +726,7 @@ void r8712_joinbss_event_callback(struct _adapter *adapter, u8 *pbuf)
struct wlan_network *pnetwork;
if (sizeof(struct list_head) == 4 * sizeof(u32)) {
- pnetwork = (struct wlan_network *)
- _malloc(sizeof(struct wlan_network));
+ pnetwork = kmalloc(sizeof(struct wlan_network), GFP_ATOMIC);
memcpy((u8 *)pnetwork+16, (u8 *)pbuf + 8,
sizeof(struct wlan_network) - 16);
} else
@@ -1212,17 +1212,15 @@ sint r8712_set_auth(struct _adapter *adapter,
struct cmd_obj *pcmd;
struct setauth_parm *psetauthparm;
- pcmd = (struct cmd_obj *)_malloc(sizeof(struct cmd_obj));
+ pcmd = kmalloc(sizeof(struct cmd_obj), GFP_ATOMIC);
if (pcmd == NULL)
return _FAIL;
- psetauthparm = (struct setauth_parm *)_malloc(
- sizeof(struct setauth_parm));
+ psetauthparm = kzalloc(sizeof(struct setauth_parm), GFP_ATOMIC);
if (psetauthparm == NULL) {
kfree((unsigned char *)pcmd);
return _FAIL;
}
- memset(psetauthparm, 0, sizeof(struct setauth_parm));
psetauthparm->mode = (u8)psecuritypriv->AuthAlgrthm;
pcmd->cmdcode = _SetAuth_CMD_;
pcmd->parmbuf = (unsigned char *)psetauthparm;
@@ -1244,15 +1242,14 @@ sint r8712_set_key(struct _adapter *adapter,
u8 keylen;
sint ret = _SUCCESS;
- pcmd = (struct cmd_obj *)_malloc(sizeof(struct cmd_obj));
+ pcmd = kmalloc(sizeof(struct cmd_obj), GFP_ATOMIC);
if (pcmd == NULL)
return _FAIL;
- psetkeyparm = (struct setkey_parm *)_malloc(sizeof(struct setkey_parm));
+ psetkeyparm = kzalloc(sizeof(struct setkey_parm), GFP_ATOMIC);
if (psetkeyparm == NULL) {
ret = _FAIL;
goto err_free_cmd;
}
- memset(psetkeyparm, 0, sizeof(struct setkey_parm));
if (psecuritypriv->AuthAlgrthm == 2) { /* 802.1X */
psetkeyparm->algorithm =
(u8)psecuritypriv->XGrpPrivacy;