adapter: Fix not checking status of stop discovery command
authorLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
Fri, 12 Jun 2020 17:11:04 +0000 (10:11 -0700)
committerAyush Garg <ayush.garg@samsung.com>
Mon, 12 Apr 2021 09:00:49 +0000 (14:30 +0530)
Status needs to be checked in order to properly synchronize the states
with the controller.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
src/adapter.c

index 6da1865..4d626a9 100644 (file)
@@ -2835,6 +2835,9 @@ static void stop_discovery_complete(uint8_t status, uint16_t length,
        if (client)
                discovery_remove(client);
 
+       if (status != MGMT_STATUS_SUCCESS)
+               return;
+
        adapter->discovery_type = 0x00;
        adapter->discovery_enable = 0x00;
        adapter->filtered_discovery = false;