Skip to content

Commit

Permalink
Bluetooth: Use zalloc when possible
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Marcel Holtmann <[email protected]>
  • Loading branch information
Johan Hedberg committed Jun 18, 2015
1 parent 7e730c7 commit 39ecfad
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions net/bluetooth/hci_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 39ecfad

Please sign in to comment.