/* Check scanning is in progress or not */
scanner = __bt_find_scanner_from_list(sender);
- if (scanner == NULL || scanner->is_scanning == FALSE)
+ if (scanner == NULL)
+ return BLUETOOTH_ERROR_NOT_IN_OPERATION;
+
+ if (scanner->is_scanning == FALSE)
return BLUETOOTH_ERROR_NOT_IN_OPERATION;
scanner->is_scanning = FALSE;
for (l = scanner_list; l != NULL; l = g_slist_next(l)) {
- scanner = l->data;
- if (scanner->is_scanning == TRUE)
+ bt_adapter_le_scanner_t *scanner_iter = l->data;
+
+ if (scanner_iter->is_scanning == TRUE)
next_scanning = TRUE;
}
_bt_unregister_all_scan_filters(sender);
- scanner = __bt_find_scanner_from_list(sender);
scanner_list = g_slist_remove(scanner_list, scanner);
__bt_free_le_scanner(scanner);