git: 520590881667 - main - Revert "ifconfig: abort if loading a module fails other than for ENOENT"

From: Alan Somers <asomers_at_FreeBSD.org>
Date: Fri, 20 Jan 2023 17:24:45 UTC
The branch main has been updated by asomers:

URL: https://cgit.FreeBSD.org/src/commit/?id=520590881667b4536e6861c710a80353a0564334

commit 520590881667b4536e6861c710a80353a0564334
Author:     Alan Somers <asomers@FreeBSD.org>
AuthorDate: 2023-01-20 17:17:21 +0000
Commit:     Alan Somers <asomers@FreeBSD.org>
CommitDate: 2023-01-20 17:17:21 +0000

    Revert "ifconfig: abort if loading a module fails other than for ENOENT"
    
    This reverts commit 2c24ad3377a6f584e484656db8390e4eb7cfc119.
    
    This change causes some commands to fail, for example when working with
    renamed interfaces or when trying to list a nonexistent interface by
    name.
    
    PR:             269042
    Reported by:    dbaio, Michael Paepcke <bugs.fbsd@paepcke.de>
    MFC with:       2c24ad3377a6f584e484656db8390e4eb7cfc119
---
 sbin/ifconfig/ifconfig.c | 18 +++++-------------
 1 file changed, 5 insertions(+), 13 deletions(-)

diff --git a/sbin/ifconfig/ifconfig.c b/sbin/ifconfig/ifconfig.c
index 120207a6927e..462d543125c4 100644
--- a/sbin/ifconfig/ifconfig.c
+++ b/sbin/ifconfig/ifconfig.c
@@ -1719,19 +1719,11 @@ ifmaybeload(const char *name)
 		}
 	}
 
-	/* Try to load the module. */
-	if (kldload(ifkind) < 0) {
-		switch (errno) {
-		case ENOENT:
-			/*
-			 * Ignore ENOENT, because ifconfig can't infer the
-			 * names of all drivers (eg mlx4en(4)).
-			 */
-			break;
-		default:
-			err(1, "kldload(%s)", ifkind);
-		}
-	}
+	/*
+	 * Try to load the module.  But ignore failures, because ifconfig can't
+	 * infer the names of all drivers (eg mlx4en(4)).
+	 */
+	(void) kldload(ifkind);
 }
 
 static struct cmd basic_cmds[] = {