Skip to content

Commit 52bc7d6

Browse files
Li ZetaoVudentz
authored andcommitted
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 <[email protected]> Signed-off-by: Luiz Augusto von Dentz <[email protected]>
1 parent cb45396 commit 52bc7d6

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

drivers/bluetooth/btrtl.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -890,10 +890,8 @@ static int rtl_load_file(struct hci_dev *hdev, const char *name, u8 **buff)
890890
if (ret < 0)
891891
return ret;
892892
ret = fw->size;
893-
*buff = kvmalloc(fw->size, GFP_KERNEL);
894-
if (*buff)
895-
memcpy(*buff, fw->data, ret);
896-
else
893+
*buff = kvmemdup(fw->data, fw->size, GFP_KERNEL);
894+
if (!*buff)
897895
ret = -ENOMEM;
898896

899897
release_firmware(fw);

0 commit comments

Comments
 (0)