From patchwork Thu Nov 20 12:03:32 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Soeren Moch X-Patchwork-Id: 412663 X-Patchwork-Delegate: sbabic@denx.de 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 443D814010F for ; Thu, 20 Nov 2014 23:03:52 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 5C3164B6BD; Thu, 20 Nov 2014 13:03:48 +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 mWPCdQwVforJ; Thu, 20 Nov 2014 13:03:47 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 71D144B6B2; Thu, 20 Nov 2014 13:03:47 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 9DCDC4B6B2 for ; Thu, 20 Nov 2014 13:03:42 +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 3wbNfUI7UPi2 for ; Thu, 20 Nov 2014 13:03:42 +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 mout.web.de (mout.web.de [212.227.17.11]) by theia.denx.de (Postfix) with ESMTPS id 738DC4B6B0 for ; Thu, 20 Nov 2014 13:03:38 +0100 (CET) Received: from platinum.vid.mst.uni-hannover.de ([130.75.30.51]) by smtp.web.de (mrweb101) with ESMTPSA (Nemesis) id 0Lc8Ph-1YGLpF47i1-00jY30; Thu, 20 Nov 2014 13:03:37 +0100 From: Soeren Moch To: u-boot@lists.denx.de Date: Thu, 20 Nov 2014 13:03:32 +0100 Message-Id: <1416485012-3351-1-git-send-email-smoch@web.de> X-Mailer: git-send-email 1.9.1 X-Provags-ID: V03:K0:/JwZZJOEAZSZbbo2QpVdyoNQ5n3zAW2eLpCQwH8qGEQ9YF9X5Ec 9GGCsrkBI4J/yRFl0FqoqCtsAfCKq2uqyT30zxWJ3EvnfKJGmRrra4WJ/hEqLwqdinpUj+t UpPED3D0T6FbUimY/56p3JZph5OEvsTTUV1IxlGCfoSWLd+8eWw+boDTAo7WI+NZNuO7VmS FKqBm9xzeC5kmN42wvd5Q== X-UI-Out-Filterresults: notjunk:1; Cc: Soeren Moch Subject: [U-Boot] [PATCH] tbs2910: Fix error handling in board_mmc_init() X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.13 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de When an invalid USDHC port is passed we should return -EINVAL instead of 0. Also, return the error immediately on fsl_esdhc_initialize() failure. Based on similar patches by Fabio Estevam for mx6sabresd, mx53loco, wandboard Signed-off-by: Soeren Moch Acked-by: Stefano Babic --- Cc: Stefano Babic Cc: Fabio Estevam --- board/tbs/tbs2910/tbs2910.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/board/tbs/tbs2910/tbs2910.c b/board/tbs/tbs2910/tbs2910.c index daf8ff4..dfa430e 100644 --- a/board/tbs/tbs2910/tbs2910.c +++ b/board/tbs/tbs2910/tbs2910.c @@ -219,15 +219,13 @@ int board_mmc_getcd(struct mmc *mmc) int board_mmc_init(bd_t *bis) { - s32 status = 0; - int i; - /* * (U-boot device node) (Physical Port) * mmc0 SD2 * mmc1 SD3 * mmc2 eMMC */ + int i, ret; for (i = 0; i < CONFIG_SYS_FSL_USDHC_NUM; i++) { switch (i) { case 0: @@ -251,12 +249,13 @@ int board_mmc_init(bd_t *bis) printf("Warning: you configured more USDHC controllers" "(%d) then supported by the board (%d)\n", i + 1, CONFIG_SYS_FSL_USDHC_NUM); - return status; + return -EINVAL; } - - status |= fsl_esdhc_initialize(bis, &usdhc_cfg[i]); + ret = fsl_esdhc_initialize(bis, &usdhc_cfg[i]); + if (ret) + return ret; } - return status; + return 0; } #endif /* CONFIG_FSL_ESDHC */