Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3e36ca48 authored by Wei Yongjun's avatar Wei Yongjun Committed by Marcel Holtmann
Browse files

Bluetooth: Use kzalloc instead of kmalloc/memset



Use kzalloc rather than kmalloc followed by memset with 0.

Generated by: scripts/coccinelle/api/alloc/kzalloc-simple.cocci

Signed-off-by: default avatarWei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
parent 4037a774
Loading
Loading
Loading
Loading
+1 −3
Original line number Diff line number Diff line
@@ -902,12 +902,10 @@ static int read_ext_controller_info(struct sock *sk, struct hci_dev *hdev,
	eir_len = eir_append_data(buff, eir_len, EIR_NAME_SHORT,
				  hdev->short_name, name_len);

	rp = kmalloc(sizeof(*rp) + eir_len, GFP_KERNEL);
	rp = kzalloc(sizeof(*rp) + eir_len, GFP_KERNEL);
	if (!rp)
		return -ENOMEM;

	memset(rp, 0, sizeof(*rp) + eir_len);

	rp->eir_len = cpu_to_le16(eir_len);
	memcpy(rp->eir, buff, eir_len);