summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLi Zetao <lizetao1@huawei.com>2024-08-21 09:24:03 +0800
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2024-09-10 13:05:57 -0400
commit52bc7d66659faac6e5a47e3ab38d8c8f590e94e5 (patch)
treef9399844b2200ad3a6ceb56db22591f1a038a2ce
parentcb45396f96f9671f7a18df481702e19998eb0f4b (diff)
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>
-rw-r--r--drivers/bluetooth/btrtl.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/drivers/bluetooth/btrtl.c b/drivers/bluetooth/btrtl.c
index d95a1cfa35ed..4c0f551a9975 100644
--- a/drivers/bluetooth/btrtl.c
+++ b/drivers/bluetooth/btrtl.c
@@ -890,10 +890,8 @@ static int rtl_load_file(struct hci_dev *hdev, const char *name, u8 **buff)
if (ret < 0)
return ret;
ret = fw->size;
- *buff = kvmalloc(fw->size, GFP_KERNEL);
- if (*buff)
- memcpy(*buff, fw->data, ret);
- else
+ *buff = kvmemdup(fw->data, fw->size, GFP_KERNEL);
+ if (!*buff)
ret = -ENOMEM;
release_firmware(fw);