All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeff Moyer <jmoyer@redhat.com>
To: Dave Jiang <dave.jiang@intel.com>, dan.j.williams@intel.com
Cc: linux-nvdimm@lists.01.org
Subject: [ndctl patch] dax_io: fix unknown parameter handling
Date: Fri, 20 Oct 2017 11:47:28 -0400	[thread overview]
Message-ID: <x49po9hes8f.fsf@segfault.boston.devel.redhat.com> (raw)

The for loop will not loop more than once due to the return statement.
What's more, the following code, which prints out the usage, 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);
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

             reply	other threads:[~2017-10-20 15:43 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-20 15:47 Jeff Moyer [this message]
2017-10-31 19:24 ` [ndctl patch] dax_io: fix unknown parameter handling Vishal Verma

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=x49po9hes8f.fsf@segfault.boston.devel.redhat.com \
    --to=jmoyer@redhat.com \
    --cc=dan.j.williams@intel.com \
    --cc=dave.jiang@intel.com \
    --cc=linux-nvdimm@lists.01.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.