Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 1 Nov 2020 16:36:22 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r367251 - head/sys/net
Message-ID:  <202011011636.0A1GaMWC028118@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);
 	}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202011011636.0A1GaMWC028118>