aboutsummaryrefslogtreecommitdiffstats
path: root/net/bluetooth/hci_core.c
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@intel.com>2014-07-03 12:33:51 -0400
committerMarcel Holtmann <marcel@holtmann.org>2014-07-03 12:45:09 -0400
commit738f61859d08771e12b552d043b48c8fc13708d1 (patch)
tree3cdd2c69e7274211f846944f972ed999199fcf3e /net/bluetooth/hci_core.c
parentbb5ce4d018f896403d7a394ec56a550e7890b563 (diff)
Bluetooth: Add identity address check in param lookup functions
Since we only store entries with identity addresses in the le_conn_params and pend_le_conns lists we can avoid unnecessary lookups by checking for an identity address before diving into the lists themselves. Signed-off-by: Johan Hedberg <johan.hedberg@intel.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/bluetooth/hci_core.c')
-rw-r--r--net/bluetooth/hci_core.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index 8882a6cd2876..750f969df8db 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -3399,6 +3399,10 @@ struct hci_conn_params *hci_conn_params_lookup(struct hci_dev *hdev,
3399{ 3399{
3400 struct hci_conn_params *params; 3400 struct hci_conn_params *params;
3401 3401
3402 /* The conn params list only contains identity addresses */
3403 if (!hci_is_identity_address(addr, addr_type))
3404 return NULL;
3405
3402 list_for_each_entry(params, &hdev->le_conn_params, list) { 3406 list_for_each_entry(params, &hdev->le_conn_params, list) {
3403 if (bacmp(&params->addr, addr) == 0 && 3407 if (bacmp(&params->addr, addr) == 0 &&
3404 params->addr_type == addr_type) { 3408 params->addr_type == addr_type) {
@@ -3432,6 +3436,10 @@ struct hci_conn_params *hci_pend_le_conn_lookup(struct hci_dev *hdev,
3432{ 3436{
3433 struct hci_conn_params *param; 3437 struct hci_conn_params *param;
3434 3438
3439 /* The list only contains identity addresses */
3440 if (!hci_is_identity_address(addr, addr_type))
3441 return NULL;
3442
3435 list_for_each_entry(param, &hdev->pend_le_conns, pend_le_conn) { 3443 list_for_each_entry(param, &hdev->pend_le_conns, pend_le_conn) {
3436 if (bacmp(&param->addr, addr) == 0 && 3444 if (bacmp(&param->addr, addr) == 0 &&
3437 param->addr_type == addr_type) 3445 param->addr_type == addr_type)