From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 65BA5C38142 for ; Fri, 27 Jan 2023 21:49:38 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id E10B5856E9; Fri, 27 Jan 2023 22:49:34 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=canonical.com 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=canonical.com header.i=@canonical.com header.b="thzTASd3"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id EE07185650; Fri, 27 Jan 2023 22:49:30 +0100 (CET) Received: from smtp-relay-canonical-1.canonical.com (smtp-relay-canonical-1.canonical.com [185.125.188.121]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 7D88C8571D for ; Fri, 27 Jan 2023 22:49:20 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=canonical.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=heinrich.schuchardt@canonical.com Received: from LT2ubnt.fritz.box (ip-088-152-145-137.um26.pools.vodafone-ip.de [88.152.145.137]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-canonical-1.canonical.com (Postfix) with ESMTPSA id AA8203F2F7; Fri, 27 Jan 2023 21:49:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1674856159; bh=Jr6EjDxiqsLj5lcn8MCFNqpw03x8PAJOklP1WcoLMxk=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=thzTASd3ANMBJZE795lUagbts18M6UtJu/ysF9qUGgfGEhH6hn37U7vjVbSx5TG8m MuXyXaoIhfqBi9g/XxyuR/4+Y9ae+jlvFOlIJNoJFwCfA4LkD1TSdfFoiLVXvv1HAS QMvyfIAUC5hfJcfK4Xiak58xMOZarmCNlSXzgulqSQ5kUMJb57QFwSFrW0I4zod/ON rYlPTZck51EJkluqbUeSRzZSOoLtD+dfxwWeB9FlzKy1MVyO6TbAO0pcm4+RoVVDvP SDW9omGRjrUf+MhoKp8tYCRp1b270LQL24FIE9JCk1qgXcK/2fGj3q0KebMavZxolp USMjH10hH/30g== From: Heinrich Schuchardt To: Stefan Roese Cc: u-boot@lists.denx.de, Baruch Siach , Heinrich Schuchardt Subject: [PATCH] cmd: return code when tlv_eeprom incorrectly called Date: Fri, 27 Jan 2023 22:49:10 +0100 Message-Id: <20230127214910.61204-1-heinrich.schuchardt@canonical.com> X-Mailer: git-send-email 2.38.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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.6 at phobos.denx.de X-Virus-Status: Clean A command called with incorrect parameters should set $? to 1 (false). Instead of calling cmd_usage(cmdtp) and then returning 0 just return CMD_RET_FAILURE. Signed-off-by: Heinrich Schuchardt --- cmd/tlv_eeprom.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/cmd/tlv_eeprom.c b/cmd/tlv_eeprom.c index bf8d453dc5..4591ff336b 100644 --- a/cmd/tlv_eeprom.c +++ b/cmd/tlv_eeprom.c @@ -479,17 +479,14 @@ int do_tlv_eeprom(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) show_tlv_devices(); break; default: - cmd_usage(cmdtp); - break; + return CMD_RET_USAGE; } return 0; } // The set command takes one or two args. - if (argc > 4) { - cmd_usage(cmdtp); - return 0; - } + if (argc > 4) + return CMD_RET_USAGE; // Set command. If the TLV exists in the EEPROM, delete it. Then if // data was supplied for this TLV add the TLV with the new contents at @@ -512,7 +509,7 @@ int do_tlv_eeprom(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) current_dev = devnum; has_been_read = 0; } else { - cmd_usage(cmdtp); + return CMD_RET_USAGE; } return 0; -- 2.38.1