From patchwork Thu Mar 2 17:45:16 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ryan Harkin X-Patchwork-Id: 94799 Delivered-To: patch@linaro.org Received: by 10.140.82.71 with SMTP id g65csp274540qgd; Thu, 2 Mar 2017 09:45:38 -0800 (PST) X-Received: by 10.223.161.140 with SMTP id u12mr12178518wru.140.1488476738818; Thu, 02 Mar 2017 09:45:38 -0800 (PST) Return-Path: Received: from lists.denx.de (dione.denx.de. [81.169.180.215]) by mx.google.com with ESMTP id j4si11489444wrj.278.2017.03.02.09.45.38; Thu, 02 Mar 2017 09:45:38 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) client-ip=81.169.180.215; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: by lists.denx.de (Postfix, from userid 105) id CFD6BC21C71; Thu, 2 Mar 2017 17:45:34 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id E573CC21C37; Thu, 2 Mar 2017 17:45:32 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 358FBC21C37; Thu, 2 Mar 2017 17:45:31 +0000 (UTC) Received: from mail-wm0-f48.google.com (mail-wm0-f48.google.com [74.125.82.48]) by lists.denx.de (Postfix) with ESMTPS id CBA4EC21C35 for ; Thu, 2 Mar 2017 17:45:30 +0000 (UTC) Received: by mail-wm0-f48.google.com with SMTP id n11so30857799wma.1 for ; Thu, 02 Mar 2017 09:45:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=sqvmoYfE2gQv+ePLq7UOGFCRcmnpOLlDN4DOIjA0pPY=; b=OSk9gQDJMfePOUvSlkVV2wKy/cNiLq+fbwZcWRzCHlpoWIjRyUhb3lUjqajcOFSksC 19LvwxV9yzUPhaPJQIBa6uDbLg6jEPT1IEizWoA8jCrRIN5Fw7Rp8rjyHulKoUj7a7n4 w+1JlWhsvltuOxdhBP9tPWbNQCD2TeHbOOmek= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=sqvmoYfE2gQv+ePLq7UOGFCRcmnpOLlDN4DOIjA0pPY=; b=ERbsSTbm/whjf0ng7+BqcGqWTrJGjIwnXUzq8hajncZk6+s/2XSsQngotzV4pRJQPW fMgz35a1wd6oQsMHW94nWQmTwMjzRX1MaAzQBbi+gFTJlPyB1kXkPC2jQI1zsQp+H8zp 1yFEzzMlZEyv1q+yGi1brxEk8tG8/j+P28rfFHL69tbkV9jkCNF4VNssowDBPI06iCcD 7neTDwqqdmL94HhsZ+5plEPcoS5om1HHhstuGTTOcwcGkdgKr/o8ZLQ2h7NMrFjeCYUm r9g8NPKYX8SFW3DqRIxgRU+rcEUlSS+q0nl1MZFXzx5xDNkEm0BbDE8bkhenICVEFjq1 ylEw== X-Gm-Message-State: AMke39nwMIobcijpc5dmgNPRNgkRHltcQQmA5tWlAiVHRBsbI8OK7dPm688PIbx/y4vvlQvs X-Received: by 10.28.150.194 with SMTP id y185mr9556759wmd.47.1488476730452; Thu, 02 Mar 2017 09:45:30 -0800 (PST) Received: from vbox.cambridge.arm.com (82-69-54-187.dsl.in-addr.zen.co.uk. [82.69.54.187]) by smtp.gmail.com with ESMTPSA id 39sm11748172wrv.55.2017.03.02.09.45.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 02 Mar 2017 09:45:29 -0800 (PST) From: Ryan Harkin To: u-boot@lists.denx.de Date: Thu, 2 Mar 2017 17:45:16 +0000 Message-Id: <1488476716-1429-1-git-send-email-ryan.harkin@linaro.org> X-Mailer: git-send-email 2.7.4 Cc: Tom Rini , Darwin Rambo , Vadzim Dambrouski Subject: [U-Boot] [PATCH] do_smhload: fix return code X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" do_smhload was using a ulong to store the return value from smh_load_file. That returns an int, where -1 indicates an error. As a ulong will never be negative, smh_load_file errors were not detected and so_smhload always returned zero. Also, when errors were spotted, do_smhload was returning 1, rather than the enumeration CMD_RET_FAILURE (which is also 1). Signed-off-by: Ryan Harkin Reviewed-by: Linus Walleij --- arch/arm/lib/semihosting.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm/lib/semihosting.c b/arch/arm/lib/semihosting.c index e32ad90..415ac89 100644 --- a/arch/arm/lib/semihosting.c +++ b/arch/arm/lib/semihosting.c @@ -186,7 +186,7 @@ static int do_smhload(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) if (argc == 3 || argc == 4) { ulong load_addr; ulong end_addr = 0; - ulong ret; + int ret; char end_str[64]; load_addr = simple_strtoul(argv[2], NULL, 16); @@ -195,7 +195,7 @@ static int do_smhload(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) ret = smh_load_file(argv[1], load_addr, &end_addr); if (ret < 0) - return 1; + return CMD_RET_FAILURE; /* Optionally save returned end to the environment */ if (argc == 4) {