Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3ea60ab5 authored by HariPrasath Elango's avatar HariPrasath Elango Committed by Greg Kroah-Hartman
Browse files

staging: wilc1000: use kmemdup instead of kmalloc and memcpy



Kmalloc followed by memcpy can be replaced by kmemdup.

Signed-off-by: default avatarHariPrasath Elango <hariprasath.elango@gmail.com>
Reviewed-by: default avatarAjay Singh <ajay.kathat@microchip.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 50413119
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -147,7 +147,7 @@ static int mon_mgmt_tx(struct net_device *dev, const u8 *buf, size_t len)
	if (!mgmt_tx)
		return -ENOMEM;

	mgmt_tx->buff = kmalloc(len, GFP_ATOMIC);
	mgmt_tx->buff = kmemdup(buf, len, GFP_ATOMIC);
	if (!mgmt_tx->buff) {
		kfree(mgmt_tx);
		return -ENOMEM;
@@ -155,7 +155,6 @@ static int mon_mgmt_tx(struct net_device *dev, const u8 *buf, size_t len)

	mgmt_tx->size = len;

	memcpy(mgmt_tx->buff, buf, len);
	wilc_wlan_txq_add_mgmt_pkt(dev, mgmt_tx, mgmt_tx->buff, mgmt_tx->size,
				   mgmt_tx_complete);