3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-12-21 11:52:34 +01:00

device: Fix valgrind warning

Device removal should probably be managed by netdev objects going away,
but for now, silence the warning
This commit is contained in:
Denis Kenzior 2016-06-15 11:01:44 -05:00
parent 31a0e42772
commit f5a7e204e7

View File

@ -1142,14 +1142,13 @@ struct device *device_create(struct wiphy *wiphy, struct netdev *netdev)
return device; return device;
} }
void device_remove(struct device *device) static void device_free(void *user)
{ {
struct device *device = user;
struct l_dbus *dbus; struct l_dbus *dbus;
l_debug(""); l_debug("");
l_queue_remove(device_list, device);
if (device->scan_pending) if (device->scan_pending)
dbus_pending_reply(&device->scan_pending, dbus_pending_reply(&device->scan_pending,
dbus_error_aborted(device->scan_pending)); dbus_error_aborted(device->scan_pending));
@ -1178,6 +1177,14 @@ void device_remove(struct device *device)
l_free(device); l_free(device);
} }
void device_remove(struct device *device)
{
if (!l_queue_remove(device_list, device))
return;
device_free(device);
}
struct wiphy *wiphy_find(int wiphy_id) struct wiphy *wiphy_find(int wiphy_id)
{ {
return l_queue_find(wiphy_list, wiphy_match, L_UINT_TO_PTR(wiphy_id)); return l_queue_find(wiphy_list, wiphy_match, L_UINT_TO_PTR(wiphy_id));
@ -1676,7 +1683,7 @@ bool wiphy_exit(void)
l_queue_destroy(wiphy_list, wiphy_free); l_queue_destroy(wiphy_list, wiphy_free);
wiphy_list = NULL; wiphy_list = NULL;
l_queue_destroy(device_list, (l_queue_destroy_func_t) device_remove); l_queue_destroy(device_list, device_free);
device_list = NULL; device_list = NULL;
nl80211 = NULL; nl80211 = NULL;