The discovery filter allocates memory for its UUID list. So use
a helper function to free it and reset it to default states.
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
hdev->discovery.rssi = HCI_RSSI_INVALID;
}
+static inline void hci_discovery_filter_clear(struct hci_dev *hdev)
+{
+ hdev->discovery.rssi = HCI_RSSI_INVALID;
+ hdev->discovery.uuid_count = 0;
+ kfree(hdev->discovery.uuids);
+ hdev->discovery.uuids = NULL;
+}
+
bool hci_discovery_active(struct hci_dev *hdev);
void hci_discovery_set_state(struct hci_dev *hdev, int state);
* count, it is important to actually free the allocated
* list of UUIDs here.
*/
- hdev->discovery.rssi = HCI_RSSI_INVALID;
- hdev->discovery.uuid_count = 0;
- kfree(hdev->discovery.uuids);
- hdev->discovery.uuids = NULL;
+ hci_discovery_filter_clear(hdev);
if (old_state != DISCOVERY_STARTING)
mgmt_discovering(hdev, 0);