Blame SOURCES/5443d71-dax_io-fix-unknown-parameter-handling.patch

bcf6bc
dax_io: fix unknown parameter handling
bcf6bc
bcf6bc
BZ: 
bcf6bc
bcf6bc
commit 5443d71625ea1082fb987fbce5eddb66c0a1e613
bcf6bc
Author: Jeff Moyer <jmoyer@redhat.com>
bcf6bc
Date:   Fri Oct 20 11:41:41 2017 -0400
bcf6bc
bcf6bc
    dax_io: fix unknown parameter handling
bcf6bc
    
bcf6bc
    The loop will never run more than once, since there's a
bcf6bc
    return.  What's more, the following code, which prints out
bcf6bc
    the usage statement, also won't run.  Let's change this to
bcf6bc
    look more like other commands.  Print out invalid options
bcf6bc
    and then print out the usage.  usage_with_options will exit,
bcf6bc
    so no need for a return there.
bcf6bc
    
bcf6bc
    Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
bcf6bc
bcf6bc
diff --git a/daxctl/io.c b/daxctl/io.c
bcf6bc
index 27e7463..2f8cb4a 100644
bcf6bc
--- a/daxctl/io.c
bcf6bc
+++ b/daxctl/io.c
bcf6bc
@@ -526,15 +526,11 @@ int cmd_io(int argc, const char **argv, void *daxctl_ctx)
bcf6bc
 	struct ndctl_ctx *ndctl_ctx;
bcf6bc
 
bcf6bc
 	argc = parse_options(argc, argv, options, u, 0);
bcf6bc
-	for (i = 0; i < argc; i++) {
bcf6bc
+	for (i = 0; i < argc; i++)
bcf6bc
 		fail("Unknown parameter \"%s\"\n", argv[i]);
bcf6bc
-		return -EINVAL;
bcf6bc
-	}
bcf6bc
 
bcf6bc
-	if (argc) {
bcf6bc
+	if (argc)
bcf6bc
 		usage_with_options(u, options);
bcf6bc
-		return 0;
bcf6bc
-	}
bcf6bc
 
bcf6bc
 	if (!io.dev[0].parm_path && !io.dev[1].parm_path) {
bcf6bc
 		usage_with_options(u, options);