diff mbox series

iwlwifi: mvm: Use kmemdup instead of kzalloc and memcpy

Message ID 20210305142956.3074-1-angkery@163.com (mailing list archive)
State New
Delegated to: Gregory Greenman
Headers show
Series iwlwifi: mvm: Use kmemdup instead of kzalloc and memcpy | expand

Commit Message

Junlin Yang March 5, 2021, 2:29 p.m. UTC
From: Junlin Yang <yangjunlin@yulong.com>

Fixes coccicheck warnings:
WARNING opportunity for kmemdup

Signed-off-by: Junlin Yang <yangjunlin@yulong.com>
 drivers/net/wireless/intel/iwlwifi/mvm/rfi.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
diff mbox series


diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/rfi.c b/drivers/net/wireless/intel/iwlwifi/mvm/rfi.c
index 8739190..f665045 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/rfi.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/rfi.c
@@ -107,12 +107,10 @@  struct iwl_rfi_freq_table_resp_cmd *iwl_rfi_get_freq_table(struct iwl_mvm *mvm)
 	if (WARN_ON_ONCE(iwl_rx_packet_payload_len(cmd.resp_pkt) != resp_size))
 		return ERR_PTR(-EIO);
-	resp = kzalloc(resp_size, GFP_KERNEL);
+	resp = kmemdup(cmd.resp_pkt->data, resp_size, GFP_KERNEL);
 	if (!resp)
 		return ERR_PTR(-ENOMEM);
-	memcpy(resp, cmd.resp_pkt->data, resp_size);
 	return resp;