diff options
author | Johan Hedberg <johan.hedberg@intel.com> | 2015-06-18 13:50:08 -0400 |
---|---|---|
committer | Johan Hedberg <johan.hedberg@intel.com> | 2015-06-18 14:00:06 -0400 |
commit | 39ecfad68f14b71b6d1917c27eb01c4936f88bda (patch) | |
tree | 66826df9fd312dd376e521a708e9c88d0acae542 /net/bluetooth | |
parent | 7e730c7f3d1f39c25cf5f7cf70c0ff4c28d7bec7 (diff) |
Bluetooth: Use zalloc when possible
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>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/bluetooth')
-rw-r--r-- | net/bluetooth/hci_core.c | 3 |
1 files changed, 1 insertions, 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, | |||
2716 | instance < 1 || instance > HCI_MAX_ADV_INSTANCES) | 2716 | instance < 1 || instance > HCI_MAX_ADV_INSTANCES) |
2717 | return -EOVERFLOW; | 2717 | return -EOVERFLOW; |
2718 | 2718 | ||
2719 | adv_instance = kmalloc(sizeof(*adv_instance), GFP_KERNEL); | 2719 | adv_instance = kzalloc(sizeof(*adv_instance), GFP_KERNEL); |
2720 | if (!adv_instance) | 2720 | if (!adv_instance) |
2721 | return -ENOMEM; | 2721 | return -ENOMEM; |
2722 | 2722 | ||
2723 | memset(adv_instance, 0, sizeof(*adv_instance)); | ||
2724 | adv_instance->pending = true; | 2723 | adv_instance->pending = true; |
2725 | adv_instance->instance = instance; | 2724 | adv_instance->instance = instance; |
2726 | list_add(&adv_instance->list, &hdev->adv_instances); | 2725 | list_add(&adv_instance->list, &hdev->adv_instances); |