This simplifies further changes. Signed-off-by: Martin Wilck <mwilck@xxxxxxxx> --- mpathpersist/main.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/mpathpersist/main.c b/mpathpersist/main.c index 10cba452..94e89c13 100644 --- a/mpathpersist/main.c +++ b/mpathpersist/main.c @@ -265,7 +265,6 @@ int main (int argc, char * argv[]) default: fprintf(stderr, "unrecognised switch " "code 0x%x ??\n", c); - usage (); ret = MPATH_PR_SYNTAX_ERROR; goto out; } @@ -283,7 +282,6 @@ int main (int argc, char * argv[]) { for (; optind < argc; ++optind) fprintf (stderr, "Unexpected extra argument: %s\n", argv[optind]); - usage (); ret = MPATH_PR_SYNTAX_ERROR; goto out; } @@ -296,14 +294,12 @@ int main (int argc, char * argv[]) if ((prout_flag + prin_flag) == 0) { fprintf (stderr, "choose either '--in' or '--out' \n"); - usage (); ret = MPATH_PR_SYNTAX_ERROR; goto out; } if ((prout_flag + prin_flag) > 1) { fprintf (stderr, "choose either '--in' or '--out' \n"); - usage (); ret = MPATH_PR_SYNTAX_ERROR; goto out; } @@ -334,20 +330,17 @@ int main (int argc, char * argv[]) { fprintf (stderr, " No service action given for Persistent Reserve IN\n"); - usage(); ret = MPATH_PR_SYNTAX_ERROR; } else if (num_prin_sa > 1) { fprintf (stderr, " Too many service actions given; choose " "one only\n"); - usage(); ret = MPATH_PR_SYNTAX_ERROR; } } else { - usage (); ret = MPATH_PR_SYNTAX_ERROR; goto out; } @@ -356,7 +349,6 @@ int main (int argc, char * argv[]) { fprintf (stderr, " --relative-target-port" " only useful with --register-move\n"); - usage (); ret = MPATH_PR_SYNTAX_ERROR; goto out; } @@ -378,7 +370,6 @@ int main (int argc, char * argv[]) if (device_name == NULL) { fprintf (stderr, "No device name given \n"); - usage (); ret = MPATH_PR_SYNTAX_ERROR; goto out; } @@ -496,6 +487,8 @@ int main (int argc, char * argv[]) } out : + if (ret == MPATH_PR_SYNTAX_ERROR) + usage(); mpath_lib_exit(conf); udev_unref(udev); return (ret >= 0) ? ret : MPATH_PR_OTHER; -- 2.21.0 -- dm-devel mailing list dm-devel@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/dm-devel