Linux bluetooth development
 help / color / mirror / Atom feed
* [PATCH v2 1/3] Bluetooth: Move memset closer to where it's needed
@ 2016-03-09 15:30 Johan Hedberg
  2016-03-09 15:30 ` [PATCH v2 2/3] Bluetooth: Fix adding discoverable to adv instance flags Johan Hedberg
  2016-03-09 15:30 ` [PATCH v2 3/3] Bluetooth: Add support for limited privacy mode Johan Hedberg
  0 siblings, 2 replies; 4+ messages in thread
From: Johan Hedberg @ 2016-03-09 15:30 UTC (permalink / raw)
  To: linux-bluetooth

From: Johan Hedberg <johan.hedberg@intel.com>

Minor fix to not do the memset until the variable it clears is
actually used.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
---
 net/bluetooth/hci_conn.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

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.
 	 */
-- 
2.5.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-03-09 15:53 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-09 15:30 [PATCH v2 1/3] Bluetooth: Move memset closer to where it's needed Johan Hedberg
2016-03-09 15:30 ` [PATCH v2 2/3] Bluetooth: Fix adding discoverable to adv instance flags Johan Hedberg
2016-03-09 15:30 ` [PATCH v2 3/3] Bluetooth: Add support for limited privacy mode Johan Hedberg
2016-03-09 15:53   ` Marcel Holtmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox