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

Johannes Zink j.zink at pengutronix.de
Fri May 5 01:07:13 PDT 2023


Hi Ahmad,

thank you for your review.

On 5/5/23 09:56, Ahmad Fatoum wrote:
> 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.

Ack, gonna add it in v2. Also, I will fix the subject line to "...exit 
with success..." instead of "...error with success...".

Johannes

> 
>> ---
>>   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.                | Johannes Zink                  |
Steuerwalder Str. 21            | https://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