diff mbox series

iwlwifi: acpi: Use kmemdup rather than duplicating its implementation in iwl_parse_nvm_mcc_info

Message ID 1538730169-145458-1-git-send-email-yuehaibing@huawei.com (mailing list archive)
State Accepted
Delegated to: Luca Coelho
Headers show
Series iwlwifi: acpi: Use kmemdup rather than duplicating its implementation in iwl_parse_nvm_mcc_info | expand

Commit Message

Yue Haibing Oct. 5, 2018, 9:02 a.m. UTC
Use kmemdup rather than duplicating its implementation

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
 drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

Comments

Luca Coelho Oct. 17, 2018, 7:25 a.m. UTC | #1
On Fri, 2018-10-05 at 09:02 +0000, YueHaibing wrote:
> Use kmemdup rather than duplicating its implementation
> 
> Signed-off-by: YueHaibing <yuehaibing@huawei.com>
> ---

Thanks, YueHaibing.  I have applied this in our internal tree and it
will eventually reach the mainline, following our normal upstreaming
process.

I have modified the subject and the commit message a bit.

--
Cheers,
Luca.
Yue Haibing Oct. 17, 2018, 7:48 a.m. UTC | #2
On 2018/10/17 15:25, Luciano Coelho wrote:
> On Fri, 2018-10-05 at 09:02 +0000, YueHaibing wrote:
>> Use kmemdup rather than duplicating its implementation
>>
>> Signed-off-by: YueHaibing <yuehaibing@huawei.com>
>> ---
> 
> Thanks, YueHaibing.  I have applied this in our internal tree and it
> will eventually reach the mainline, following our normal upstreaming
> process.
> 
> I have modified the subject and the commit message a bit.

Thanks you!

> 
> --
> Cheers,
> Luca.
> 
> 
> .
>
diff mbox series

Patch

diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c b/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c
index ec300d3..d979c00 100644
--- a/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c
+++ b/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c
@@ -1108,14 +1108,12 @@  struct ieee80211_regdomain *
 	regd_to_copy = sizeof(struct ieee80211_regdomain) +
 		valid_rules * sizeof(struct ieee80211_reg_rule);
 
-	copy_rd = kzalloc(regd_to_copy, GFP_KERNEL);
+	copy_rd = kmemdup(regd, regd_to_copy, GFP_KERNEL);
 	if (!copy_rd) {
 		copy_rd = ERR_PTR(-ENOMEM);
 		goto out;
 	}
 
-	memcpy(copy_rd, regd, regd_to_copy);
-
 out:
 	kfree(regdb_ptrs);
 	kfree(regd);