Commit 79f712ea authored by Larry Finger's avatar Larry Finger Committed by Greg Kroah-Hartman
Browse files

staging: r8188eu: Remove wrappers for kalloc() and kzalloc()



These wrappers involve an in_interrupt() call, which is not frowned on
in the kernel. These changes decrease the size of the driver by a trivial
amount.

Signed-off-by: default avatarLarry Finger <Larry.Finger@lwfinger.net>
Link: https://lore.kernel.org/r/20210805183717.23007-2-Larry.Finger@lwfinger.net


Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 66e9564a
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -98,7 +98,7 @@ static void update_BCNTIM(struct adapter *padapter)
		}

		if (remainder_ielen > 0) {
			pbackup_remainder_ie = rtw_malloc(remainder_ielen);
			pbackup_remainder_ie = kmalloc(remainder_ielen, GFP_KERNEL);
			if (pbackup_remainder_ie && premainder_ie)
				memcpy(pbackup_remainder_ie, premainder_ie, remainder_ielen);
		}
@@ -180,7 +180,7 @@ void rtw_add_bcn_ie(struct adapter *padapter, struct wlan_bssid_ex *pnetwork, u8
	}

	if (remainder_ielen > 0) {
		pbackup_remainder_ie = rtw_malloc(remainder_ielen);
		pbackup_remainder_ie = kmalloc(remainder_ielen, GFP_KERNEL);
		if (pbackup_remainder_ie && premainder_ie)
			memcpy(pbackup_remainder_ie, premainder_ie, remainder_ielen);
	}
@@ -224,7 +224,7 @@ void rtw_remove_bcn_ie(struct adapter *padapter, struct wlan_bssid_ex *pnetwork,
	}

	if (remainder_ielen > 0) {
		pbackup_remainder_ie = rtw_malloc(remainder_ielen);
		pbackup_remainder_ie = kmalloc(remainder_ielen, GFP_KERNEL);
		if (pbackup_remainder_ie && premainder_ie)
			memcpy(pbackup_remainder_ie, premainder_ie, remainder_ielen);
	}
@@ -1302,7 +1302,7 @@ static void update_bcn_wps_ie(struct adapter *padapter)
	remainder_ielen = ielen - wps_offset - wps_ielen;

	if (remainder_ielen > 0) {
		pbackup_remainder_ie = rtw_malloc(remainder_ielen);
		pbackup_remainder_ie = kmalloc(remainder_ielen, GFP_KERNEL);
		if (pbackup_remainder_ie)
			memcpy(pbackup_remainder_ie, premainder_ie, remainder_ielen);
	}
+1 −1
Original line number Diff line number Diff line
@@ -394,7 +394,7 @@ static void __nat25_db_network_insert(struct adapter *priv,
		}
		db = db->next_hash;
	}
	db = (struct nat25_network_db_entry *) rtw_malloc(sizeof(*db));
	db = kmalloc(sizeof(*db), GFP_KERNEL);
	if (!db) {
		spin_unlock_bh(&priv->br_ext_lock);
		return;
+7 −4
Original line number Diff line number Diff line
@@ -1947,11 +1947,14 @@ static void c2h_wk_callback(struct work_struct *work)
		if ((c2h_evt = (struct c2h_evt_hdr *)rtw_cbuf_pop(evtpriv->c2h_queue)) != NULL) {
			/* This C2H event is read, clear it */
			c2h_evt_clear(adapter);
		} else if ((c2h_evt = (struct c2h_evt_hdr *)rtw_malloc(16)) != NULL) {
		} else {
			c2h_evt = kmalloc(16, GFP_KERNEL);
			if (c2h_evt) {
				/* This C2H event is not read, read & clear now */
				if (c2h_evt_read(adapter, (u8 *)c2h_evt) != _SUCCESS)
					continue;
			}
		}

		/* Special pointer to trigger c2h_evt_clear only */
		if ((void *)c2h_evt == (void *)evtpriv)
+2 −2
Original line number Diff line number Diff line
@@ -533,7 +533,7 @@ u8 rtw_efuse_map_write(struct adapter *padapter, u16 addr, u16 cnts, u8 *data)
	if ((addr + cnts) > mapLen)
		return _FAIL;

	map = rtw_zmalloc(mapLen);
	map = kzalloc(mapLen, GFP_KERNEL);
	if (!map)
		return _FAIL;

@@ -625,7 +625,7 @@ u8 rtw_BT_efuse_map_write(struct adapter *padapter, u16 addr, u16 cnts, u8 *data
	if ((addr + cnts) > mapLen)
		return _FAIL;

	map = rtw_zmalloc(mapLen);
	map = kzalloc(mapLen, GFP_KERNEL);
	if (!map)
		return _FAIL;

+4 −4
Original line number Diff line number Diff line
@@ -1735,13 +1735,13 @@ int rtw_set_auth(struct adapter *adapter, struct security_priv *psecuritypriv)
	struct	cmd_priv *pcmdpriv = &(adapter->cmdpriv);
	int		res = _SUCCESS;

	pcmd = (struct	cmd_obj *)rtw_zmalloc(sizeof(struct cmd_obj));
	pcmd = kzalloc(sizeof(struct cmd_obj), GFP_KERNEL);
	if (!pcmd) {
		res = _FAIL;  /* try again */
		goto exit;
	}

	psetauthparm = (struct setauth_parm *)rtw_zmalloc(sizeof(struct setauth_parm));
	psetauthparm = kzalloc(sizeof(struct setauth_parm), GFP_KERNEL);
	if (!psetauthparm) {
		kfree(pcmd);
		res = _FAIL;
@@ -1773,12 +1773,12 @@ int rtw_set_key(struct adapter *adapter, struct security_priv *psecuritypriv, in
	struct mlme_priv		*pmlmepriv = &(adapter->mlmepriv);
	int	res = _SUCCESS;

	pcmd = (struct	cmd_obj *)rtw_zmalloc(sizeof(struct	cmd_obj));
	pcmd = kzalloc(sizeof(struct cmd_obj), GFP_KERNEL);
	if (!pcmd) {
		res = _FAIL;  /* try again */
		goto exit;
	}
	psetkeyparm = (struct setkey_parm *)rtw_zmalloc(sizeof(struct setkey_parm));
	psetkeyparm = kzalloc(sizeof(struct setkey_parm), GFP_KERNEL);
	if (!psetkeyparm) {
		kfree(pcmd);
		res = _FAIL;
Loading