Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 172B0C4338F for ; Fri, 6 Aug 2021 16:08:09 +0000 (UTC) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7007A61102 for ; Fri, 6 Aug 2021 16:08:08 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 7007A61102 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 8FF2E83135; Fri, 6 Aug 2021 18:08:05 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.b="LtlyhAG+"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id DF4EC83132; Fri, 6 Aug 2021 18:08:02 +0200 (CEST) Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 3DAB98262E for ; Fri, 6 Aug 2021 18:08:00 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=pali@kernel.org Received: by mail.kernel.org (Postfix) with ESMTPSA id 1FD9961102; Fri, 6 Aug 2021 16:07:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1628266078; bh=ORwMqYpNn0t7j84/LGedmiSHXMEkQwkVfKo5xqbha3M=; h=From:To:Cc:Subject:Date:From; b=LtlyhAG+pzaK5WCXABazlAq/yPzWhMqLEg5Y+vvr4Iz14NCbQWhlpk6cDTJcacSV1 YOq3ivM4ZoMTroRBYGl84DsU6doXZaPBelkI3XnqmzBHRE4pHhrg9LVBzmDeulPOB/ F2EuXmCkEhNVnI5oEca/N8sgWw2c3bOfCMDtqK8bNqqxzocPvRelUjOKH+9O3OclkG IG6Y2sm6AnU66JOHkPlXdsLcA68Xc2A69wT37y9Lzv4+VVESelBdgcMUfgW0rrJ/Am gIE31xyT5TuHgwtUa65lSy0avxT/XeHkSEPe7X3N/SobI8fYT6b+xFcCAvEIBr5eqc eeKElQrXj+B0w== Received: by pali.im (Postfix) id 94336768; Fri, 6 Aug 2021 18:07:55 +0200 (CEST) From: =?UTF-8?q?Pali=20Roh=C3=A1r?= To: Simon Glass , Heinrich Schuchardt , Michal Simek Cc: u-boot@lists.denx.de Subject: [PATCH] loadb: Properly indicate aborted kermit transfer Date: Fri, 6 Aug 2021 18:07:39 +0200 Message-Id: <20210806160739.18003-1-pali@kernel.org> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean 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 --- 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 */ + flush_cache(offset, size); printf("## Total Size = 0x%08x = %d Bytes\n", size, size); -- 2.20.1