From patchwork Mon Jul 13 19:00:59 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Otavio Salvador X-Patchwork-Id: 494673 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 489BB1402E2 for ; Tue, 14 Jul 2015 05:02:06 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id C11134B6A8; Mon, 13 Jul 2015 21:01:57 +0200 (CEST) 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 uElxxxn4yhFq; Mon, 13 Jul 2015 21:01:57 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 23B6B4B657; Mon, 13 Jul 2015 21:01:57 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 354E74B6B2 for ; Mon, 13 Jul 2015 21:01:55 +0200 (CEST) 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 5q-hDSgjERVX for ; Mon, 13 Jul 2015 21:01:55 +0200 (CEST) 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 mail-qk0-f169.google.com (mail-qk0-f169.google.com [209.85.220.169]) by theia.denx.de (Postfix) with ESMTPS id 200B84B698 for ; Mon, 13 Jul 2015 21:01:49 +0200 (CEST) Received: by qkdl129 with SMTP id l129so18440151qkd.0 for ; Mon, 13 Jul 2015 12:01:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=from:to:cc:subject:date:message-id:in-reply-to:references :organization; bh=RGY2DrsZrZcFDzClev3atgoc8w6CdtKQdA+SlgBzwCA=; b=MxAtjdWl/ExPqcqcYnGr73uDGR6Plwh8WTnrpTHvow5f28/2Le7cQpjcdpl+KbGRtp 8R6tgmk/YjW9rsntqPwTGsIZTUE5pI1Cm+cIK/T0h9JFdfIC5LHigYrbI9kzFovzjd2I btZOrGAMFwA+PMgtmR/d41UKEUgIVf0NwyeTLOq4ixN8ydZSvBrepMuin7EP7GSdfAp/ KGBiwDEHaNsi/eVkmqLsJTyLFGhH54bQIkfpdHlIHoPpVhSQLl0JUNSab/GGzf/EAlJY JTTOhWSer/N0hH7bWKb/3qrGAKgPJRTcdNsbKILONnYVs9wQblpIBmEsLJazmBEUd14r HkdA== X-Received: by 10.140.239.9 with SMTP id k9mr58937631qhc.38.1436814108003; Mon, 13 Jul 2015 12:01:48 -0700 (PDT) Received: from localhost ([179.105.243.19]) by smtp.gmail.com with ESMTPSA id 125sm11240173qhx.44.2015.07.13.12.01.43 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 13 Jul 2015 12:01:46 -0700 (PDT) Received: by localhost (sSMTP sendmail emulation); Mon, 13 Jul 2015 16:01:40 -0300 From: Otavio Salvador To: U-Boot Mailing List Date: Mon, 13 Jul 2015 16:00:59 -0300 Message-Id: <1436814070-9108-4-git-send-email-otavio@ossystems.com.br> X-Mailer: git-send-email 2.4.5 In-Reply-To: <1436814070-9108-1-git-send-email-otavio@ossystems.com.br> References: <1436814070-9108-1-git-send-email-otavio@ossystems.com.br> Organization: O.S. Systems Software LTDA. Cc: Tom Rini , Michael.Schanz@congatec.com, Otavio Salvador , Alejandro.de-cabo-Garcia@congatec.com Subject: [U-Boot] [PATCH v2 04/15] cgtqmx6eval: Improve the error handling X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Perfoming an OR operation on the error is not a good approach. Return the error immediately for each ESDHC instance instead. Signed-off-by: Otavio Salvador --- Changes in v2: - use ARRAY_SIZE(usdhc_cfg) (Marek) board/congatec/cgtqmx6eval/cgtqmx6eval.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/board/congatec/cgtqmx6eval/cgtqmx6eval.c b/board/congatec/cgtqmx6eval/cgtqmx6eval.c index eb6395a..0f43d3c 100644 --- a/board/congatec/cgtqmx6eval/cgtqmx6eval.c +++ b/board/congatec/cgtqmx6eval/cgtqmx6eval.c @@ -98,6 +98,7 @@ int board_mmc_getcd(struct mmc *mmc) int board_mmc_init(bd_t *bis) { s32 status = 0; + int i; usdhc_cfg[0].sdhc_clk = mxc_get_clock(MXC_ESDHC2_CLK); usdhc_cfg[1].sdhc_clk = mxc_get_clock(MXC_ESDHC4_CLK); @@ -107,10 +108,13 @@ int board_mmc_init(bd_t *bis) imx_iomux_v3_setup_multiple_pads( usdhc4_pads, ARRAY_SIZE(usdhc4_pads)); - status = fsl_esdhc_initialize(bis, &usdhc_cfg[0]) | - fsl_esdhc_initialize(bis, &usdhc_cfg[1]); + for (i = 0; i < ARRAY_SIZE(usdhc_cfg); i++) { + status = fsl_esdhc_initialize(bis, &usdhc_cfg[i]); + if (status) + return status; + } - return status; + return 0; } #endif