Skip to content

Commit

Permalink
iwlwifi: use kmemdup in iwl_parse_nvm_mcc_info()
Browse files Browse the repository at this point in the history
Use kmemdup rather than duplicating its implementation in
iwl_parse_nvm_mcc_info().

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
  • Loading branch information
YueHaibing authored and Luca Coelho committed Jan 25, 2019
1 parent e7eed19 commit af84282
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c
Original file line number Diff line number Diff line change
Expand Up @@ -1195,14 +1195,12 @@ iwl_parse_nvm_mcc_info(struct device *dev, const struct iwl_cfg *cfg,
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);
Expand Down

0 comments on commit af84282

Please sign in to comment.