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

Ahmad Fatoum a.fatoum at pengutronix.de
Fri May 5 00:56:54 PDT 2023


On 05.05.23 09:53, Johannes Zink wrote:
> 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.
> 
> Signed-off-by: Johannes Zink <j.zink at pengutronix.de>

Reviewed-by: Ahmad Fatoum <a.fatoum at pengutronix.de>

The diff doesn't show that the other usage() callsite has an exit(1)
following it. Please note such things in the commit message in the
future.

> ---
>  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;

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |




More information about the barebox mailing list