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 EEACEC6FD1F for ; Sun, 19 Mar 2023 16:34:28 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 6C94183CB4; Sun, 19 Mar 2023 17:34:23 +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="PVLzOiTE"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id EA67C84EC7; Sun, 19 Mar 2023 17:34:20 +0100 (CET) Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) (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 89DAD83AA4 for ; Sun, 19 Mar 2023 17:34:16 +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 50CCEB80C74; Sun, 19 Mar 2023 16:34:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D9B41C433EF; Sun, 19 Mar 2023 16:34:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1679243653; bh=3jiyYKK5FXv6FwWX7O+a+TEswv3WEMopmv3gkem4rCU=; h=From:To:Cc:Subject:Date:From; b=PVLzOiTELFFldFlm/XQ/v1q3WRiAibeLvHYpyS/z3rPdY3OqdnfyJLL4JSf6XEQ/N EcpZZyCwxELbqTlboHNPYfFXUUvFhbYMmY/tD8WRkFGK/HS0FuMxb6VWf8KHxZjqCB H3yg6f3zFHfrJZ8vk9t0HJESWowUrhYHY63W+eRzaeMpx1ZwKiKanVRWZHMh7iNq3V 1t7ycJAs0HRcu4Mdlct7Y79GISgVK2SzjoGcms0COaiSRd9izrqg4G4mbXsrIBzEku L4BmL48YD3vhtYXgN7nAwGNnxcgm1d5YfNteDGu5suSNJc34nEZ4wFRJqGwO8ZZTZx iHpEeB8Tsww5w== Received: by pali.im (Postfix) id 14A5E622; Sun, 19 Mar 2023 17:34:10 +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 u-boot] cmd: mmc: Return CMD_RET_* from commands Date: Sun, 19 Mar 2023 17:33:42 +0100 Message-Id: <20230319163342.15385-1-pali@kernel.org> X-Mailer: git-send-email 2.20.1 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 --- cmd/mmc.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/cmd/mmc.c b/cmd/mmc.c index c79d9407986d..0b8fc903e1f6 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 r, 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); + r = mmc_set_part_conf(mmc, ack, part_num, access); + if (r != 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 r, 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); + r = mmc_set_rst_n_function(mmc, enable); + if (r != 0) + return CMD_RET_FAILURE; + + return CMD_RET_SUCCESS; } #endif static int do_mmc_setdsr(struct cmd_tbl *cmdtp, int flag, -- 2.20.1