From 05bdba77681a5c123573d4a7ef8f3a0b27588d20 Mon Sep 17 00:00:00 2001 From: Szymon Janc Date: Thu, 2 Jun 2016 14:45:07 +0200 Subject: [PATCH] Bluetooth: Fix clearing BT_DEV_ENABLE on HCI reset complete BT_DEV_ENABLE flag value must be preserved after HCI reset is complete to not allow calling bt_enable more then once. Change-Id: I77bf6111d4fc2a209e0c5a56717decba156068a6 Signed-off-by: Szymon Janc --- net/bluetooth/hci_core.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c index bbf075b918c..3512fa4db4d 100644 --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c @@ -2021,7 +2021,9 @@ static void hci_reset_complete(struct net_buf *buf) discovery_results_size = 0; discovery_results_count = 0; #endif /* CONFIG_BLUETOOTH_BREDR */ - atomic_set(bt_dev.flags, 0); + + /* we only allow to enable once so this bit must be keep set */ + atomic_set(bt_dev.flags, BIT(BT_DEV_ENABLE)); } static void hci_cmd_done(uint16_t opcode, uint8_t status, struct net_buf *buf)