diff options
author | Alexandru Gheorghiu <gheorghiuandru@gmail.com> | 2013-03-17 01:16:50 -0400 |
---|---|---|
committer | Gustavo Padovan <gustavo.padovan@collabora.co.uk> | 2013-03-18 13:01:50 -0400 |
commit | 5ae327f0efc12d35ea8c98007310c35c143c1e21 (patch) | |
tree | 8d36997ffa41f6841fcd6022256f5f93e53f9e5e /net/bluetooth/a2mp.c | |
parent | 12033caf2380dbd28a497519eece9e92ccdca1c7 (diff) |
Bluetooth: Replaced kzalloc and memcpy with kmemdup
Replaced calls to kzalloc followed by memcpy with a single call to kmemdup.
Signed-off-by: Alexandru Gheorghiu <gheorghiuandru@gmail.com>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Diffstat (limited to 'net/bluetooth/a2mp.c')
-rw-r--r-- | net/bluetooth/a2mp.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/net/bluetooth/a2mp.c b/net/bluetooth/a2mp.c index eb0f4b16ff09..17f33a62f6db 100644 --- a/net/bluetooth/a2mp.c +++ b/net/bluetooth/a2mp.c | |||
@@ -397,13 +397,12 @@ static int a2mp_getampassoc_rsp(struct amp_mgr *mgr, struct sk_buff *skb, | |||
397 | if (ctrl) { | 397 | if (ctrl) { |
398 | u8 *assoc; | 398 | u8 *assoc; |
399 | 399 | ||
400 | assoc = kzalloc(assoc_len, GFP_KERNEL); | 400 | assoc = kmemdup(rsp->amp_assoc, assoc_len, GFP_KERNEL); |
401 | if (!assoc) { | 401 | if (!assoc) { |
402 | amp_ctrl_put(ctrl); | 402 | amp_ctrl_put(ctrl); |
403 | return -ENOMEM; | 403 | return -ENOMEM; |
404 | } | 404 | } |
405 | 405 | ||
406 | memcpy(assoc, rsp->amp_assoc, assoc_len); | ||
407 | ctrl->assoc = assoc; | 406 | ctrl->assoc = assoc; |
408 | ctrl->assoc_len = assoc_len; | 407 | ctrl->assoc_len = assoc_len; |
409 | ctrl->assoc_rem_len = assoc_len; | 408 | ctrl->assoc_rem_len = assoc_len; |
@@ -472,13 +471,12 @@ static int a2mp_createphyslink_req(struct amp_mgr *mgr, struct sk_buff *skb, | |||
472 | size_t assoc_len = le16_to_cpu(hdr->len) - sizeof(*req); | 471 | size_t assoc_len = le16_to_cpu(hdr->len) - sizeof(*req); |
473 | u8 *assoc; | 472 | u8 *assoc; |
474 | 473 | ||
475 | assoc = kzalloc(assoc_len, GFP_KERNEL); | 474 | assoc = kmemdup(req->amp_assoc, assoc_len, GFP_KERNEL); |
476 | if (!assoc) { | 475 | if (!assoc) { |
477 | amp_ctrl_put(ctrl); | 476 | amp_ctrl_put(ctrl); |
478 | return -ENOMEM; | 477 | return -ENOMEM; |
479 | } | 478 | } |
480 | 479 | ||
481 | memcpy(assoc, req->amp_assoc, assoc_len); | ||
482 | ctrl->assoc = assoc; | 480 | ctrl->assoc = assoc; |
483 | ctrl->assoc_len = assoc_len; | 481 | ctrl->assoc_len = assoc_len; |
484 | ctrl->assoc_rem_len = assoc_len; | 482 | ctrl->assoc_rem_len = assoc_len; |