Blob Blame History Raw
dax_io: fix unknown parameter handling

BZ: 

commit 5443d71625ea1082fb987fbce5eddb66c0a1e613
Author: Jeff Moyer <jmoyer@redhat.com>
Date:   Fri Oct 20 11:41:41 2017 -0400

    dax_io: fix unknown parameter handling
    
    The loop will never run more than once, since there's a
    return.  What's more, the following code, which prints out
    the usage statement, also won't run.  Let's change this to
    look more like other commands.  Print out invalid options
    and then print out the usage.  usage_with_options will exit,
    so no need for a return there.
    
    Signed-off-by: Jeff Moyer <jmoyer@redhat.com>

diff --git a/daxctl/io.c b/daxctl/io.c
index 27e7463..2f8cb4a 100644
--- a/daxctl/io.c
+++ b/daxctl/io.c
@@ -526,15 +526,11 @@ int cmd_io(int argc, const char **argv, void *daxctl_ctx)
 	struct ndctl_ctx *ndctl_ctx;
 
 	argc = parse_options(argc, argv, options, u, 0);
-	for (i = 0; i < argc; i++) {
+	for (i = 0; i < argc; i++)
 		fail("Unknown parameter \"%s\"\n", argv[i]);
-		return -EINVAL;
-	}
 
-	if (argc) {
+	if (argc)
 		usage_with_options(u, options);
-		return 0;
-	}
 
 	if (!io.dev[0].parm_path && !io.dev[1].parm_path) {
 		usage_with_options(u, options);