From 5b208e718a3f431c2ab157556b811469e3486a03 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Thu, 2 Jul 2015 15:00:37 +0200 Subject: [PATCH] platform: remove unreachable code in nm_platform_link_get_all() Linux platform tracks links by ifindex. Hence an ifindex must be unique and positive. Just assert against it. --- src/platform/nm-platform.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/platform/nm-platform.c b/src/platform/nm-platform.c index d200df61fd..ed0d3c4340 100644 --- a/src/platform/nm-platform.c +++ b/src/platform/nm-platform.c @@ -444,15 +444,10 @@ nm_platform_link_get_all (NMPlatform *self) for (i = 0; i < links->len; i++) { item = &g_array_index (links, NMPlatformLink, i); - if (item->ifindex <= 0 || g_hash_table_contains (unseen, GINT_TO_POINTER (item->ifindex))) { - _LOGT ("link-get: SKIP: %3d: %s", i, nm_platform_link_to_string (item)); - g_warn_if_reached (); - item->ifindex = 0; - continue; - } - _LOGT ("link-get: %3d: %s", i, nm_platform_link_to_string (item)); + nm_assert (item->ifindex > 0 && !g_hash_table_contains (unseen, GINT_TO_POINTER (item->ifindex))); + g_hash_table_insert (unseen, GINT_TO_POINTER (item->ifindex), NULL); }