git: 19cba6662468 - stable/14 - rc: Fix improper use of load_kld

From: Dag-Erling Smørgrav <des_at_FreeBSD.org>
Date: Sun, 28 Jun 2026 09:43:55 UTC
The branch stable/14 has been updated by des:

URL: https://cgit.FreeBSD.org/src/commit/?id=19cba66624689b5ed628a641cf5da4b2b76203c9

commit 19cba66624689b5ed628a641cf5da4b2b76203c9
Author:     Dag-Erling Smørgrav <des@FreeBSD.org>
AuthorDate: 2026-06-23 15:23:25 +0000
Commit:     Dag-Erling Smørgrav <des@FreeBSD.org>
CommitDate: 2026-06-28 09:43:43 +0000

    rc: Fix improper use of load_kld
    
    Fix scripts that needlessly used -e when the simpler -m would work, or
    that used -m when the module and file name are the same, or, in one
    particularly egregious case, used -m with the wrong name when using
    nothing at all would have worked just fine.
    
    MFC after:      1 week
    Reviewed by:    imp
    Differential Revision:  https://reviews.freebsd.org/D57705
    
    (cherry picked from commit cfe1962a19259fea8f51673f4da6c96656776486)
---
 libexec/rc/rc.d/bthidd          | 6 +++---
 libexec/rc/rc.d/cfumass         | 2 +-
 libexec/rc/rc.d/linux           | 8 ++++----
 libexec/rc/rc.d/mountcritremote | 2 +-
 4 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/libexec/rc/rc.d/bthidd b/libexec/rc/rc.d/bthidd
index ec7da8181ca3..624b2b1be00f 100755
--- a/libexec/rc/rc.d/bthidd
+++ b/libexec/rc/rc.d/bthidd
@@ -35,9 +35,9 @@ bthidd_prestart()
 	if evdev_enabled; then
 		load_kld -m uinput uinput
 	fi
-	load_kld -m kbdmux kbdmux
-	load_kld -m vkbd vkbd
-	load_kld -m ng_btsocket ng_btsocket
+	load_kld kbdmux kbdmux
+	load_kld vkbd vkbd
+	load_kld ng_btsocket
 	return 0
 }
 
diff --git a/libexec/rc/rc.d/cfumass b/libexec/rc/rc.d/cfumass
index 79c9b0ae63d4..3ca40883725e 100755
--- a/libexec/rc/rc.d/cfumass
+++ b/libexec/rc/rc.d/cfumass
@@ -74,7 +74,7 @@ cfumass_start()
 		return "${err}"
 	fi
 
-	load_kld -e cfumass cfumass
+	load_kld -m ctlcfumass cfumass
 
 	# If the template is already switched to Mass Storage, then reset
 	# it to -1 to force the host to reenumerate it; otherwise it might
diff --git a/libexec/rc/rc.d/linux b/libexec/rc/rc.d/linux
index 1c6a97f606fe..3669bfeb1e55 100755
--- a/libexec/rc/rc.d/linux
+++ b/libexec/rc/rc.d/linux
@@ -31,14 +31,14 @@ linux_start()
 
 	case `sysctl -n hw.machine_arch` in
 	aarch64)
-		load_kld -e 'linux64elf' linux64
+		load_kld -m linux64elf linux64
 		;;
 	amd64)
-		load_kld -e 'linuxelf' linux
-		load_kld -e 'linux64elf' linux64
+		load_kld -m linuxelf linux
+		load_kld -m linux64elf linux64
 		;;
 	i386)
-		load_kld -e 'linuxelf' linux
+		load_kld -m linuxelf linux
 		;;
 	esac
 
diff --git a/libexec/rc/rc.d/mountcritremote b/libexec/rc/rc.d/mountcritremote
index b2e0f9cfec49..298d6cfbf074 100755
--- a/libexec/rc/rc.d/mountcritremote
+++ b/libexec/rc/rc.d/mountcritremote
@@ -26,7 +26,7 @@ mountcritremote_precmd()
 	case "`mount -d -a -t nfs 2> /dev/null`" in
 	*mount_nfs*)
 		# Handle absent nfs client support
-		load_kld -m nfs nfscl || return 1
+		load_kld nfscl || return 1
 		;;
 	esac
 	return 0