qmi: fix bad lookup and double free

This function was never removing discovery instances because it was looking
them up in the wrong list.  This led to some strangeness with the discovery
callbacks being invoked after the "failure" timeout of 5 seconds and
consequent failures with everything getting out of sync.

With this patch we fix the lookup to use the correct queue.  There's also
a double-free in the function that was never being hit before because the
lookups never succeeded; fix that as well.

With this, service discovery and creation work as expected when testing with
an EC21.
This commit is contained in:
Jonas Bonn 2017-04-03 14:27:33 +02:00 committed by Denis Kenzior
parent 529afeb67f
commit 1e39a9d26d
1 changed files with 1 additions and 2 deletions

View File

@ -901,7 +901,7 @@ static void __qmi_device_discovery_complete(struct qmi_device *device,
GList *list;
struct discovery *d;
list = g_queue_find_custom(device->req_queue,
list = g_queue_find_custom(device->discovery_queue,
discover_data, __discovery_compare);
if (!list)
return;
@ -909,7 +909,6 @@ static void __qmi_device_discovery_complete(struct qmi_device *device,
d = list->data;
g_queue_delete_link(device->discovery_queue, list);
d->destroy(d->discover_data);
__discovery_free(d, NULL);
}