[PATCH] loadb: Properly indicate aborted kermit transfer

Heinrich Schuchardt xypron.glpk at gmx.de
Fri Aug 6 18:23:49 CEST 2021



On 8/6/21 6:07 PM, Pali Rohár wrote:
> When k_recv() returns zero it indicates that kermit transfer was aborted.
> Function do_load_serial_bin() (caller of load_serial_bin()) interprets
> value ~0 as aborted transfer, so properly propagates information about
> aborted transfer from k_recv() to do_load_serial_bin().
>
> Signed-off-by: Pali Rohár <pali at kernel.org>
> ---
>   cmd/load.c | 3 +++
>   1 file changed, 3 insertions(+)
>
> diff --git a/cmd/load.c b/cmd/load.c
> index 462340ad2cde..249ebd4ae078 100644
> --- a/cmd/load.c
> +++ b/cmd/load.c
> @@ -551,6 +551,9 @@ static ulong load_serial_bin(ulong offset)
>   		udelay(1000);
>   	}
>
> +	if (size == 0)
> +		return ~0; /* Download aborted */
> +

I cannot see where k_recv() sets the return value to 0 if the download
is interrupted after transferring the first packages. So isn't some
logic in k_recv() missing to identify an abort?

Best regards

Heinrich

>   	flush_cache(offset, size);
>
>   	printf("## Total Size      = 0x%08x = %d Bytes\n", size, size);
>


More information about the U-Boot mailing list