svn commit: r367251 - head/sys/net

Konstantin Belousov kib at FreeBSD.org
Sun Nov 1 16:36:22 UTC 2020


Author: kib
Date: Sun Nov  1 16:36:21 2020
New Revision: 367251
URL: https://svnweb.freebsd.org/changeset/base/367251

Log:
  Cleanup of net/if_media.c: simplify cleanup loop in ifmedia_removeall().
  
  Reviewed by:	hselasky
  Sponsored by:	Mellanox Technologies/NVidia Networking
  MFC after:	1 week
  Differential revision:	https://reviews.freebsd.org/D27034

Modified:
  head/sys/net/if_media.c

Modified: head/sys/net/if_media.c
==============================================================================
--- head/sys/net/if_media.c	Sun Nov  1 16:30:17 2020	(r367250)
+++ head/sys/net/if_media.c	Sun Nov  1 16:36:21 2020	(r367251)
@@ -102,8 +102,7 @@ ifmedia_removeall(struct ifmedia *ifm)
 {
 	struct ifmedia_entry *entry;
 
-	for (entry = LIST_FIRST(&ifm->ifm_list); entry;
-	     entry = LIST_FIRST(&ifm->ifm_list)) {
+	while ((entry = LIST_FIRST(&ifm->ifm_list)) != NULL) {
 		LIST_REMOVE(entry, ifm_list);
 		free(entry, M_IFADDR);
 	}


More information about the svn-src-head mailing list