Bluetooth: Move memset closer to where it's needed
authorJohan Hedberg <johan.hedberg@intel.com>
Wed, 9 Mar 2016 15:30:32 +0000 (17:30 +0200)
committerMarcel Holtmann <marcel@holtmann.org>
Thu, 10 Mar 2016 18:51:29 +0000 (19:51 +0100)
Minor fix to not do the memset until the variable it clears is
actually used.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
net/bluetooth/hci_conn.c

index 32575b49f4a0c2218ef8a084888bc8469ba92306..7264025dc78130d1665a15c584e57425edf61b3d 100644 (file)
@@ -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.
         */