[PATCH v2 1/3] imx-usb-loader: exit with success when displaying help on purpose

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Previously, whenever the usage was displayed, the imx-usb-loader exited
with error code.

When the usage is displayed due to invalid tool invocation, returning an
error code is valid behaviour, but when displaying the usage with the -h
command line option, success should be returned.

The other usage() callsite in the code already has an exit(1) following
it, which is why the exit call can be removed from the usage function
without introducing any behavioural change there.

Signed-off-by: Johannes Zink <j.zink@xxxxxxxxxxxxxx>
---
Changelog:

 v1 -> v2: - fixed erronous commit subject
           - added comment in commit message why removing the exit()
	     call is from the usage() function is valid, even when not
	     explicitely adding an exit() call at all call sites

 scripts/imx/imx-usb-loader.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/imx/imx-usb-loader.c b/scripts/imx/imx-usb-loader.c
index 41d57906c752..17b83b611765 100644
--- a/scripts/imx/imx-usb-loader.c
+++ b/scripts/imx/imx-usb-loader.c
@@ -1527,7 +1527,6 @@ static void usage(const char *prgname)
 		"-s           skip DCD included in image\n"
 		"-v           verbose (give multiple times to increase)\n"
 		"-h           this help\n", prgname);
-	exit(1);
 }
 
 int main(int argc, char *argv[])
@@ -1558,6 +1557,7 @@ int main(int argc, char *argv[])
 			break;
 		case 'h':
 			usage(argv[0]);
+			exit(0);
 		case 'd':
 			devtype = optarg;
 			break;
-- 
2.39.2





[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux