From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marek Vasut Date: Mon, 13 Jul 2015 17:59:18 +0200 Subject: [U-Boot] [PATCH 05/16] cgtqmx6eval: Improve the error handling In-Reply-To: <1436800998-21248-5-git-send-email-otavio@ossystems.com.br> References: <1436800998-21248-1-git-send-email-otavio@ossystems.com.br> <1436800998-21248-5-git-send-email-otavio@ossystems.com.br> Message-ID: <201507131759.18636.marex@denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Monday, July 13, 2015 at 05:23:07 PM, Otavio Salvador wrote: > 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 > --- > > 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..b23859c 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 < 2; i++) { Is this magic 2 equal to ARRAY_SIZE(usdhc_cfg) ? > + status = fsl_esdhc_initialize(bis, &usdhc_cfg[i]); > + if (status) > + return status; > + } > > - return status; > + return 0; > } > #endif Best regards, Marek Vasut