From patchwork Wed Jan 11 15:51:53 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gary Bisson X-Patchwork-Id: 713801 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 3tzD105hgFz9sXx for ; Thu, 12 Jan 2017 02:52:20 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=boundarydevices-com.20150623.gappssmtp.com header.i=@boundarydevices-com.20150623.gappssmtp.com header.b="ZoFlVNEd"; dkim-atps=neutral Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 135A9B38CD; Wed, 11 Jan 2017 16:52:18 +0100 (CET) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id vnxcRGbjZush; Wed, 11 Jan 2017 16:52:17 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 146B5B389C; Wed, 11 Jan 2017 16:52:17 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 5C530B389C for ; Wed, 11 Jan 2017 16:52:04 +0100 (CET) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id KsD45a-Fhc2X for ; Wed, 11 Jan 2017 16:52:03 +0100 (CET) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail-wm0-f52.google.com (mail-wm0-f52.google.com [74.125.82.52]) by theia.denx.de (Postfix) with ESMTPS id 5EE5CB3857 for ; Wed, 11 Jan 2017 16:51:59 +0100 (CET) Received: by mail-wm0-f52.google.com with SMTP id r126so15803339wmr.0 for ; Wed, 11 Jan 2017 07:51:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=boundarydevices-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=Xn2qtsqIvHW8zyhYmja5OpYcHss55Mzgq/trvATHirw=; b=ZoFlVNEdX2IvHmD1XmzwU0ZQUO8iVM70MHw27+9zDxqAxC23TH3Y54b6LwjJbLMnl8 Ul8Lel15oelhaXBmx+MCJOJMKqopJMlNQK4C44zJKkbWu8DdigS5xyRjnr6b0XG/Ek9G Y8NGifBlUGnb3KdiHnE8bzyO7KWujYFMt/F8u3cXcPAwhYWD5y9XZ0xGnb90Ps1Y/e9o 5S3NZrGz4DX87nfaRK3NJ+cxDIqomh94Kh/76gh0H99ZqGkHwEKH4qx8LWQ+CKyRO5gU /e7U1V/nVGz8FBzwCaMjphqbASp4NVExk/evqRcSqavfn8PvKOZWX7ws6WiEONLWd85i 6Ypg== 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=Xn2qtsqIvHW8zyhYmja5OpYcHss55Mzgq/trvATHirw=; b=dBt1b3asz8wwFo5zyHEUHliAVsZKI8DyjKSa4Y1rG0/RpT7izoC9mhE5V0gxP7fbZg GGa/1cQfNtKQOEQ2X7JwJ6qWzklzqVPz6R0PZ21R3Wzq8GKua0uw9IPxiuUua/xnVl32 b/c9BWfM+3UYmfSvWZenqj9uNWwEve/XhIa7gO+qzNXsAN5+rrGrN85UG2CpoByMZEMd 8TiN0YfPPASOsdy9GxjRZ+kXiVNgT4HabQEJ5TjJXThe4zokINrVzYS+fOk3g1JCNmj2 th6zurH7FYPrq0g1Ctcr7c+9bXjJjOApptWBTlBlQmpPAlwir/mVZxcS2vOEWUV7i3Lj 1U4w== X-Gm-Message-State: AIkVDXKUir2nqM9IcouKcRVKkk0/MVrt7E3K2jSDY1e720A2W5zuAhW9N35R9lMGHxuUNw== X-Received: by 10.28.105.78 with SMTP id e75mr4025694wmc.55.1484149918788; Wed, 11 Jan 2017 07:51:58 -0800 (PST) Received: from localhost.localdomain (LMontsouris-657-1-10-89.w90-63.abo.wanadoo.fr. [90.63.251.89]) by smtp.googlemail.com with ESMTPSA id jq4sm9084377wjc.24.2017.01.11.07.51.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 11 Jan 2017 07:51:57 -0800 (PST) From: Gary Bisson To: u-boot@lists.denx.de Date: Wed, 11 Jan 2017 16:51:53 +0100 Message-Id: <20170111155153.21311-1-gary.bisson@boundarydevices.com> X-Mailer: git-send-email 2.11.0 Cc: Gary Bisson Subject: [U-Boot] [PATCH] cmd: sata: fix init command return value X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 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" Since commit aa6ab905b2, sata_initialize returns -1 if init_sata or scan_sata fails. But this return value becomes the do_sata return value which is equivalent to CMD_RET_USAGE. In case one issues 'sata init' and that the hardware fails to initialize, there's no need to display the command usage. Instead the command shoud just return the CMD_RET_FAILURE value. Fixes: aa6ab905b2 (sata: fix sata command can not being executed bug) Signed-off-by: Gary Bisson Reviewed-by: Eric Nelson Reviewed-by: Simon Glass --- cmd/sata.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cmd/sata.c b/cmd/sata.c index f56622acc2..4c53022ff6 100644 --- a/cmd/sata.c +++ b/cmd/sata.c @@ -28,14 +28,15 @@ static int do_sata(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) if (sata_curr_device != -1) sata_stop(); - return sata_initialize(); + return (sata_initialize() < 0) ? + CMD_RET_FAILURE : CMD_RET_SUCCESS; } /* If the user has not yet run `sata init`, do it now */ if (sata_curr_device == -1) { rc = sata_initialize(); if (rc == -1) - return rc; + return CMD_RET_FAILURE; sata_curr_device = rc; }