git: a327bd30588f - stable/13 - loader: Fix pnpmatch and add some usage

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

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

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

    loader: Fix pnpmatch and add some usage
    
    pnpmatch needs a busname and a compat data.
    
    (cherry picked from commit 544af629a4906be1873983dfa129e65bc5d0c3df)
---
 stand/common/module.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/stand/common/module.c b/stand/common/module.c
index 8bddd9f56f52..9b001089149d 100644
--- a/stand/common/module.c
+++ b/stand/common/module.c
@@ -381,14 +381,19 @@ command_pnpmatch(int argc, char *argv[])
 			return(CMD_OK);
 		}
 	}
-	argv += (optind - 1);
-	argc -= (optind - 1);
+	argv += optind;
+	argc -= optind;
 
-	module = mod_searchmodule_pnpinfo(argv[1], argv[2]);
+	if (argc != 2) {
+		command_errmsg = "Usage: pnpmatch <busname> compat=<compatdata>";
+		return (CMD_CRIT);
+	}
+
+	module = mod_searchmodule_pnpinfo(argv[0], argv[1]);
 	if (module)
 		printf("Matched module: %s\n", module);
-	else if(argv[1])
-		printf("No module matches %s\n", argv[1]);
+	else
+		printf("No module matches %s on bus %s\n", argv[1], argv[0]);
 
 	return (CMD_OK);
 }