All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Bluetooth: Use zalloc when possible
@ 2015-06-18 17:50 Johan Hedberg
  2015-06-18 17:54 ` Marcel Holtmann
  0 siblings, 1 reply; 2+ messages in thread
From: Johan Hedberg @ 2015-06-18 17:50 UTC (permalink / raw)
  To: linux-bluetooth

From: Johan Hedberg <johan.hedberg@intel.com>

Use zallog for adv_instance allocation instead of kmalloc + memset.
This also fixes the following coccinelle warning:

>> net/bluetooth/hci_core.c:2693:17-24: WARNING: kzalloc should be
used for adv_instance, instead of kmalloc/memset

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
---
 net/bluetooth/hci_core.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index 86ed44e39649..2f8fb33067e1 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -2716,11 +2716,10 @@ int hci_add_adv_instance(struct hci_dev *hdev, u8 instance, u32 flags,
 		    instance < 1 || instance > HCI_MAX_ADV_INSTANCES)
 			return -EOVERFLOW;
 
-		adv_instance = kmalloc(sizeof(*adv_instance), GFP_KERNEL);
+		adv_instance = kzalloc(sizeof(*adv_instance), GFP_KERNEL);
 		if (!adv_instance)
 			return -ENOMEM;
 
-		memset(adv_instance, 0, sizeof(*adv_instance));
 		adv_instance->pending = true;
 		adv_instance->instance = instance;
 		list_add(&adv_instance->list, &hdev->adv_instances);
-- 
2.4.3


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] Bluetooth: Use zalloc when possible
  2015-06-18 17:50 [PATCH] Bluetooth: Use zalloc when possible Johan Hedberg
@ 2015-06-18 17:54 ` Marcel Holtmann
  0 siblings, 0 replies; 2+ messages in thread
From: Marcel Holtmann @ 2015-06-18 17:54 UTC (permalink / raw)
  To: Johan Hedberg; +Cc: linux-bluetooth

Hi Johan,

> Use zallog for adv_instance allocation instead of kmalloc + memset.
> This also fixes the following coccinelle warning:
> 
>>> net/bluetooth/hci_core.c:2693:17-24: WARNING: kzalloc should be
> used for adv_instance, instead of kmalloc/memset
> 
> Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
> ---
> net/bluetooth/hci_core.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)

patch has been applied to bluetooth-next tree.

Regards

Marcel


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-06-18 17:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-18 17:50 [PATCH] Bluetooth: Use zalloc when possible Johan Hedberg
2015-06-18 17:54 ` Marcel Holtmann

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.