Skip to contentSkip to conversation

Bluetooth: Fix using test_and_clear instead of test_and_set

PATCH In review [email protected] 2 participants 2 messages Jul 10, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Bluetooth: Fix using test_and_clear instead of test_and_set

From: Johan Hedberg <[email protected]>

The code for updating the HCI_CONNECTABLE flag was incorrectly using test_and_set_bit instead of test_and_clear_bit when HCI_CONNECTABLE is to be cleared.

---
 net/bluetooth/hci_core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
net/bluetooth/hci_core.c +2 -2
index 84431b86af96..8f9df768f250 100644
@@ -2726,8 +2726,8 @@ int hci_dev_cmd(unsigned int cmd, void __user *arg)
 				changed = !test_and_set_bit(HCI_CONNECTABLE,
 							    &hdev->dev_flags);
 			else
-				changed = test_and_set_bit(HCI_CONNECTABLE,
-							   &hdev->dev_flags);
+				changed = test_and_clear_bit(HCI_CONNECTABLE,
+							     &hdev->dev_flags);
 
 			if (changed)
 				mgmt_new_settings(hdev);
Signature · 1 line
1.9.3
maintainer
#1 lore raw

Hi Johan,

Quoted 8 lines

The code for updating the HCI_CONNECTABLE flag was incorrectly using test_and_set_bit instead of test_and_clear_bit when HCI_CONNECTABLE is to be cleared.

---
net/bluetooth/hci_core.c | 4 ++--

1 file changed, 2 insertions(+), 2 deletions(-)

patch has been applied to bluetooth-next tree.

Regards

Marcel