netdev: Remove device when netdev is freed

This commit is contained in:
Denis Kenzior 2016-06-24 23:04:01 -05:00
parent 105f5f8d8e
commit 49abd4556f
1 changed files with 4 additions and 1 deletions

View File

@ -54,6 +54,7 @@ struct netdev {
uint32_t type;
uint8_t addr[ETH_ALEN];
struct l_io *eapol_io;
struct device *device;
netdev_event_func_t event_filter;
netdev_connect_cb_t connect_cb;
@ -227,6 +228,8 @@ static void netdev_free(void *data)
l_debug("Freeing netdev %s[%d]", netdev->name, netdev->index);
device_remove(netdev->device);
if (netdev->sm) {
eapol_sm_free(netdev->sm);
netdev->sm = NULL;
@ -1319,7 +1322,7 @@ static void netdev_get_interface_callback(struct l_genl_msg *msg,
netdev);
l_debug("Found interface %s[%d]", netdev->name, netdev->index);
device_create(wiphy, netdev);
netdev->device = device_create(wiphy, netdev);
/* Query interface flags */
bufsize = NLMSG_LENGTH(sizeof(struct ifinfomsg));