git: e52cb5ee22c7 - stable/13 - loader: Fix pnpload and add some usage

From: Emmanuel Vadot <manu_at_FreeBSD.org>
Date: Fri, 14 Jan 2022 13:42:08 UTC
The branch stable/13 has been updated by manu:

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

commit e52cb5ee22c786864463e076eb97af51094f5dad
Author:     Emmanuel Vadot <manu@FreeBSD.org>
AuthorDate: 2021-11-14 14:22:14 +0000
Commit:     Emmanuel Vadot <manu@FreeBSD.org>
CommitDate: 2022-01-14 13:37:55 +0000

    loader: Fix pnpload and add some usage
    
    pnpload needs a busname and a compat data.
    
    (cherry picked from commit d4874307fd5dc825e8a80adf7a531ed4bc43f235)
---
 stand/common/module.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/stand/common/module.c b/stand/common/module.c
index 9b001089149d..e6567c735f36 100644
--- a/stand/common/module.c
+++ b/stand/common/module.c
@@ -424,13 +424,15 @@ command_pnpload(int argc, char *argv[])
 			return(CMD_OK);
 		}
 	}
-	argv += (optind - 1);
-	argc -= (optind - 1);
+	argv += optind;
+	argc -= optind;
 
-	if (argc != 2)
+	if (argc != 2) {
+		command_errmsg = "Usage: pnpload <busname> compat=<compatdata>";
 		return (CMD_ERROR);
+	}
 
-	module = mod_searchmodule_pnpinfo(argv[1], argv[2]);
+	module = mod_searchmodule_pnpinfo(argv[0], argv[1]);
 
 	error = mod_load(module, NULL, 0, NULL);
 	if (error == EEXIST) {