]> git.sur5r.net Git - u-boot/commitdiff
cgtqmx6eval: Improve the error handling
authorOtavio Salvador <otavio@ossystems.com.br>
Thu, 23 Jul 2015 14:02:22 +0000 (11:02 -0300)
committerStefano Babic <sbabic@denx.de>
Sun, 26 Jul 2015 10:21:58 +0000 (12:21 +0200)
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 <otavio@ossystems.com.br>
board/congatec/cgtqmx6eval/cgtqmx6eval.c

index eb6395a50c19f8f3cf7d1dab7986c9ef57d03ff9..0f43d3c3519f351d20699a12b4b916bf93936762 100644 (file)
@@ -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