]> git.karo-electronics.de Git - linux-beck.git/commitdiff
Bluetooth: Use zalloc when possible
authorJohan Hedberg <johan.hedberg@intel.com>
Thu, 18 Jun 2015 17:50:08 +0000 (20:50 +0300)
committerJohan Hedberg <johan.hedberg@intel.com>
Thu, 18 Jun 2015 18:00:06 +0000 (21:00 +0300)
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>
net/bluetooth/hci_core.c

index 86ed44e396490daee2617adcf0eb9c4b1b47e121..2f8fb33067e1c48fedf3055ddf29a3be68161c9f 100644 (file)
@@ -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);