Bluetooth: hci_sync: Fix hci_update_accept_list_sync
Subsystems (2)
Luiz Augusto von Dentz
maintainerPATCH 1/1 Bluetooth: hci_sync: Fix hci_update_accept_list_sync
From: Luiz Augusto von Dentz <[email protected]>
hci_update_accept_list_sync is returning the filter based on the error but that gets overwritten by hci_le_set_addr_resolution_enable_sync return instead of using the actual result of the likes of hci_le_add_accept_list_sync which was intended.
--- net/bluetooth/hci_sync.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
net/bluetooth/hci_sync.c +4 -2
@@ -1844,7 +1844,7 @@ static u8 hci_update_accept_list_sync(struct hci_dev *hdev)struct bdaddr_list *b, *t;u8 num_entries =0 ;bool pend_conn, pend_report; -int err; +int err, ret;/* Pause advertising if resolving list can be used as controllers are * cannot accept resolving list modifications while advertising.
@@ -1930,6 +1930,8 @@ static u8 hci_update_accept_list_sync(struct hci_dev *hdev) err = -EINVAL ; done: + ret = err ?0x00 :0x01 ; +/* Enable address resolution when LL Privacy is enabled. */ err =hci_le_set_addr_resolution_enable_sync (hdev,0x01 );if (err)
@@ -1940,7 +1942,7 @@ static u8 hci_update_accept_list_sync(struct hci_dev *hdev)hci_resume_advertising_sync (hdev);/* Select filter policy to use accept list */ -return err ?0x00 :0x01 ; +return ret; }/* Returns true if an le connection is in the scanning state */
Signature · 1 line
2.35.1
This is automated email and please do not reply to this email!
Dear submitter,
Thank you for submitting the patches to the linux bluetooth mailing list. This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=617449
---Test result---
Test Summary:
CheckPatch PASS 1.64 seconds GitLint PASS 0.95 seconds SubjectPrefix PASS 0.87 seconds BuildKernel PASS 32.63 seconds BuildKernel32 PASS 27.62 seconds Incremental Build with patchesPASS 37.65 seconds TestRunner: Setup PASS 511.88 seconds TestRunner: l2cap-tester PASS 14.90 seconds TestRunner: bnep-tester PASS 7.02 seconds TestRunner: mgmt-tester PASS 116.05 seconds TestRunner: rfcomm-tester PASS 8.99 seconds TestRunner: sco-tester PASS 9.00 seconds TestRunner: smp-tester PASS 8.50 seconds TestRunner: userchan-tester PASS 7.13 seconds
---
Regards,
Linux Bluetooth
Marcel Holtmann
maintainerHi Luiz,
Quoted 34 lines
hci_update_accept_list_syncis returning the filter based on the error but that gets overwritten byhci_le_set_addr_resolution_enable_syncreturn instead of using the actual result of the likes ofhci_le_add_accept_list_syncwhich was intended.Fixes ad383c2c65a5b ("Bluetooth: hci_sync: Enable advertising when LL privacy is enabled")Signed-off-by Luiz Augusto von Dentz <[email protected]>---
net/bluetooth/hci_sync.c| 6 ++++--1 file changed, 4 insertions(+), 2 deletions(-)net/bluetooth/hci_sync.c +1
-1@@ -1844,7 +1844,7 @@ static u8 hci_update_accept_list_sync(struct hci_dev *hdev)struct bdaddr_list *b, *t;u8 num_entries =0 ;bool pend_conn, pend_report; -int err; +int err, ret;/* Pause advertising if resolving list can be used as controllers are * cannot accept resolving list modifications while advertising. @@ -1930,6 +1930,8 @@ static u8 hci_update_accept_list_sync(struct hci_dev *hdev) err = -EINVAL ;done:
net/bluetooth/hci_sync.c +2
-0+ ret = err ?0x00 :0x01 ; +/* Enable address resolution when LL Privacy is enabled. */ err = hci_le_set_addr_resolution_enable_sync(hdev, 0x01); if (err)
net/bluetooth/hci_sync.c static u8 hci_update_accept_list_sync(struct hci_dev *hdev) · line 1946
Quoted 6 lines
net/bluetooth/hci_sync.c +1
-1@@ -1940,7 +1942,7 @@ static u8 hci_update_accept_list_sync(struct hci_dev *hdev)hci_resume_advertising_sync (hdev);/* Select filter policy to use accept list */ -return err ?0x00 :0x01 ; +return ret; }
hmmmmm. I dislike the usage of err and ret together. That makes for some hard to read code (and the return value is u8 and not int).
Maybe doing
u8 filter_policy = 0x00; ...
And then
done:
/* select filter policy to use accept list */ filter_policy = 0x01; ... return filter_policy; }
Regards
Marcel