* [PATCH -next] Bluetooth: btrtl: Use kvmemdup to simplify the code
@ 2024-08-21 1:24 Li Zetao
2024-08-21 14:50 ` patchwork-bot+bluetooth
0 siblings, 1 reply; 2+ messages in thread
From: Li Zetao @ 2024-08-21 1:24 UTC (permalink / raw)
To: marcel, luiz.dentz; +Cc: lizetao1, linux-bluetooth
Use kvmemdup instead of kvmalloc() + memcpy() to simplify the code.
No functional change intended.
Signed-off-by: Li Zetao <lizetao1@huawei.com>
---
drivers/bluetooth/btrtl.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/bluetooth/btrtl.c b/drivers/bluetooth/btrtl.c
index f2f37143c454..96754c8a4461 100644
--- a/drivers/bluetooth/btrtl.c
+++ b/drivers/bluetooth/btrtl.c
@@ -878,10 +878,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);
--
2.34.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-08-21 14:50 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-21 1:24 [PATCH -next] Bluetooth: btrtl: Use kvmemdup to simplify the code Li Zetao
2024-08-21 14:50 ` patchwork-bot+bluetooth
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox