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 79A09C05027 for ; Sun, 29 Jan 2023 16:18:15 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 106D385565; Sun, 29 Jan 2023 17:18:12 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=tkos.co.il 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; secure) header.d=tkos.co.il header.i=@tkos.co.il header.b="mZ6TsaAh"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 1A9FE8549C; Sun, 29 Jan 2023 17:18:11 +0100 (CET) Received: from mail.tkos.co.il (golan.tkos.co.il [84.110.109.230]) (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 32CD78558A for ; Sun, 29 Jan 2023 17:18:08 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=tkos.co.il Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=baruch@tkos.co.il Received: from tarshish (unknown [10.0.8.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.tkos.co.il (Postfix) with ESMTPS id EA700440159; Sun, 29 Jan 2023 18:14:11 +0200 (IST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tkos.co.il; s=default; t=1675008852; bh=0rr6xbYA0LzC8WB86GNgS+2973GqDEA9FtIA96SUbjs=; h=References:From:To:Cc:Subject:Date:In-reply-to:From; b=mZ6TsaAhdDYBaRFWs6OlJgeedV6DVtDqLg1Rz931/fPSxb5WsEs8pLcapAEvDD7pE 4ojD4goEZ3C3vXI4LsCkJKlltMd+Qwlw33q1W+zg1HVH6IpXmupVCxVH2MqWiwyrhY wfL26DWHpAHSFx7wG7a23o9t+lmoHCUGjjlT6mUVVL0BFq1Hz861SvN1jF0MFF19Gj YwGwxwkN9mT2u+bX12mRueu2gVWeIyAqro+XgFXwGWSQua6M1Q1VmTgAN6F+H7Y7TN 8Pvi59qijWzt8G2qQRRwE4R+nP8rtpwAY+4AP3W42sfnjWwZfimFhZjzDRvbAw8a6l qBQueHxFQvcGg== References: <20230127214910.61204-1-heinrich.schuchardt@canonical.com> User-agent: mu4e 1.8.13; emacs 28.2 From: Baruch Siach To: Heinrich Schuchardt Cc: Stefan Roese , u-boot@lists.denx.de Subject: Re: [PATCH] cmd: return code when tlv_eeprom incorrectly called Date: Sun, 29 Jan 2023 18:16:58 +0200 In-reply-to: <20230127214910.61204-1-heinrich.schuchardt@canonical.com> Message-ID: <87bkmhxqkh.fsf@tarshish> MIME-Version: 1.0 Content-Type: text/plain 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 Hi Heinrich, On Fri, Jan 27 2023, Heinrich Schuchardt wrote: > 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 Acked-by: Baruch Siach Thanks, baruch > --- > 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; -- ~. .~ Tk Open Systems =}------------------------------------------------ooO--U--Ooo------------{= - baruch@tkos.co.il - tel: +972.52.368.4656, http://www.tkos.co.il -