netdev_unreg: modyify netdev remove logical when mutil-netdev exist

This commit is contained in:
exxfire 2024-03-15 15:42:14 +08:00 committed by Meco Man
parent 2d7770ecdc
commit 90f86c2b71
1 changed files with 10 additions and 2 deletions

View File

@ -165,9 +165,17 @@ int netdev_unregister(struct netdev *netdev)
if (cur_netdev == netdev)
{
/* find this network interface device in network interface device list */
if (netdev_list == netdev && rt_slist_next(&netdev_list->list) == RT_NULL)
if (netdev_list == netdev)
{
netdev_list = RT_NULL;
rt_slist_t *next = rt_slist_next(node);
if (next)
{
netdev_list = rt_slist_entry(next, struct netdev, list);
}
else
{
netdev_list = RT_NULL;
}
}
else
{