mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: Johannes Zink <j.zink@pengutronix.de>, barebox@lists.infradead.org
Cc: kernel@pengutronix.de, patchwork-jzi@pengutronix.de
Subject: Re: [PATCH v1 1/3] imx-usb-loader: error with success when displaying help on purpose
Date: Fri, 5 May 2023 09:56:54 +0200	[thread overview]
Message-ID: <32e5a633-8921-0d69-0a1e-03efa8162493@pengutronix.de> (raw)
In-Reply-To: <20230505075308.1015157-2-j.zink@pengutronix.de>

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@pengutronix.de>

Reviewed-by: Ahmad Fatoum <a.fatoum@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 |




  reply	other threads:[~2023-05-05  7:58 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-05  7:53 [PATCH v1 0/3] Add displaying a version number in Johannes Zink
2023-05-05  7:53 ` [PATCH v1 1/3] imx-usb-loader: error with success when displaying help on purpose Johannes Zink
2023-05-05  7:56   ` Ahmad Fatoum [this message]
2023-05-05  8:07     ` Johannes Zink
2023-05-05  7:53 ` [PATCH v1 2/3] imx-usb-loader: use proper return code macros Johannes Zink
2023-05-05  7:53 ` [PATCH v1 3/3] imx-usb-loader: add commandline option for displaying version number Johannes Zink
2023-05-05  8:02   ` Ahmad Fatoum
2023-05-05  8:26     ` Johannes Zink
2023-05-05  8:32       ` Ahmad Fatoum

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=32e5a633-8921-0d69-0a1e-03efa8162493@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=j.zink@pengutronix.de \
    --cc=kernel@pengutronix.de \
    --cc=patchwork-jzi@pengutronix.de \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox