From: Johan Hedberg Date: Wed, 9 Mar 2016 15:30:32 +0000 (+0200) Subject: Bluetooth: Move memset closer to where it's needed X-Git-Tag: v4.13~3428^2~44^2~5 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=eec7a01dc8366f7e43fc0417f4aee70eaeaca9a9;p=mirror_ubuntu-bionic-kernel.git Bluetooth: Move memset closer to where it's needed Minor fix to not do the memset until the variable it clears is actually used. Signed-off-by: Johan Hedberg Signed-off-by: Marcel Holtmann --- diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c index 32575b49f4a0..7264025dc781 100644 --- a/net/bluetooth/hci_conn.c +++ b/net/bluetooth/hci_conn.c @@ -726,14 +726,14 @@ static void hci_req_add_le_create_conn(struct hci_request *req, struct hci_dev *hdev = conn->hdev; u8 own_addr_type; - memset(&cp, 0, sizeof(cp)); - /* Update random address, but set require_privacy to false so * that we never connect with an non-resolvable address. */ if (hci_update_random_address(req, false, &own_addr_type)) return; + memset(&cp, 0, sizeof(cp)); + /* Set window to be the same value as the interval to enable * continuous scanning. */