git: 8f59fdb65239 - stable/15 - rc: Fix improper use of load_kld

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

URL: https://cgit.FreeBSD.org/src/commit/?id=8f59fdb652395e148905073ea214e335160977d8

commit 8f59fdb652395e148905073ea214e335160977d8
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:39 +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 4b230406c4d5..275106a53d1e 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 7d1117d7c388..b3ddd2ceedc8 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 d419920acaca..52a465a85b94 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 99becaefb10f..df8ab01b1dd0 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