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 12770C6FD1F for ; Wed, 22 Mar 2023 20:07:49 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 0799A85D62; Wed, 22 Mar 2023 21:07:47 +0100 (CET) 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="hKh0HV/8"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 8D74785D5D; Wed, 22 Mar 2023 21:07:44 +0100 (CET) Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) (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 20EF085D5D for ; Wed, 22 Mar 2023 21:07:42 +0100 (CET) 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: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id AA8F1B81DD0; Wed, 22 Mar 2023 20:07:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3EDE3C433EF; Wed, 22 Mar 2023 20:07:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1679515660; bh=G2y/xksTrFUrtvEHxIh2ZrLWroYcy4BWlgwZtuRJJY4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hKh0HV/8uwB92UVjcQH8cd1d3Wpbs/f5EX3G619pLKi/D3fIJECiBW2sIdcDoNqJk 0dgqpyQPXj7oObvLRvOlTB3gmSkRX402k+5y7tiFSTUBojrZR5cTHG9D0liIBi0mfJ PZICocdl4lk1CLdL9BVWYxkHgLMVHTytulAoU7umc6CLPvuZD410hKgPO5Pgkfe3Hz 0KWXT2onhPjv6jeIOzb2knWuQJalOQ7efjfzW9Zb1lUXYNGQyQglMXNkUNpeBlOi11 s62LJh2upGYAfIFCgDLsupnbjv5/5SiU8pkghKEht1M6BVANlzQQHYCNqiXLW6tF3y Tnvqvle9dnJgA== Received: by pali.im (Postfix) id 81C5F565; Wed, 22 Mar 2023 21:07:37 +0100 (CET) From: =?UTF-8?q?Pali=20Roh=C3=A1r?= To: Simon Glass , Heinrich Schuchardt Cc: u-boot@lists.denx.de, Martin Rowe Subject: [PATCH v2 u-boot] cmd: mmc: Return CMD_RET_* from commands Date: Wed, 22 Mar 2023 21:06:53 +0100 Message-Id: <20230322200653.8360-1-pali@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20230319163342.15385-1-pali@kernel.org> References: <20230319163342.15385-1-pali@kernel.org> 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.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.8 at phobos.denx.de X-Virus-Status: Clean Numeric return values may cause strange errors line: exit not allowed from main input shell. Signed-off-by: Pali Rohár --- Rename r to ret. --- cmd/mmc.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/cmd/mmc.c b/cmd/mmc.c index c79d9407986d..539d3e0bf768 100644 --- a/cmd/mmc.c +++ b/cmd/mmc.c @@ -175,7 +175,7 @@ static int do_mmcinfo(struct cmd_tbl *cmdtp, int flag, int argc, curr_device = 0; else { puts("No MMC device available\n"); - return 1; + return CMD_RET_FAILURE; } } @@ -927,7 +927,7 @@ static int mmc_partconf_print(struct mmc *mmc, const char *varname) static int do_mmc_partconf(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) { - int dev; + int ret, dev; struct mmc *mmc; u8 ack, part_num, access; @@ -953,13 +953,17 @@ static int do_mmc_partconf(struct cmd_tbl *cmdtp, int flag, access = dectoul(argv[4], NULL); /* acknowledge to be sent during boot operation */ - return mmc_set_part_conf(mmc, ack, part_num, access); + ret = mmc_set_part_conf(mmc, ack, part_num, access); + if (ret != 0) + return CMD_RET_FAILURE; + + return CMD_RET_SUCCESS; } static int do_mmc_rst_func(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) { - int dev; + int ret, dev; struct mmc *mmc; u8 enable; @@ -988,7 +992,11 @@ static int do_mmc_rst_func(struct cmd_tbl *cmdtp, int flag, return CMD_RET_FAILURE; } - return mmc_set_rst_n_function(mmc, enable); + ret = mmc_set_rst_n_function(mmc, enable); + if (ret != 0) + return CMD_RET_FAILURE; + + return CMD_RET_SUCCESS; } #endif static int do_mmc_setdsr(struct cmd_tbl *cmdtp, int flag, -- 2.20.1