1

Bluetooth: btrtl: Use kvmemdup to simplify the code

Use kvmemdup instead of kvmalloc() + memcpy() to simplify the code.

No functional change intended.

Signed-off-by: Li Zetao <lizetao1@huawei.com>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This commit is contained in:
Li Zetao 2024-08-21 09:24:03 +08:00 committed by Luiz Augusto von Dentz
parent cb45396f96
commit 52bc7d6665

View File

@ -890,10 +890,8 @@ static int rtl_load_file(struct hci_dev *hdev, const char *name, u8 **buff)
if (ret < 0) if (ret < 0)
return ret; return ret;
ret = fw->size; ret = fw->size;
*buff = kvmalloc(fw->size, GFP_KERNEL); *buff = kvmemdup(fw->data, fw->size, GFP_KERNEL);
if (*buff) if (!*buff)
memcpy(*buff, fw->data, ret);
else
ret = -ENOMEM; ret = -ENOMEM;
release_firmware(fw); release_firmware(fw);