Commit c5ba77ac05eb22b097291eaeb0b956327f1b2b5f

Authored by Fabio Estevam
Committed by Stefano Babic
1 parent a49c44dd8b

mx53smd: Fix error handling in board_mmc_init()

When an invalid USDHC port is passed we should return -EINVAL instead of 0.

Also, return the error immediately on fsl_esdhc_initialize() failure.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>

Showing 1 changed file with 6 additions and 4 deletions Side-by-side Diff

board/freescale/mx53smd/mx53smd.c
... ... @@ -106,7 +106,7 @@
106 106 };
107 107  
108 108 u32 index;
109   - s32 status = 0;
  109 + int ret;
110 110  
111 111 esdhc_cfg[0].sdhc_clk = mxc_get_clock(MXC_ESDHC_CLK);
112 112  
113 113  
114 114  
... ... @@ -121,12 +121,14 @@
121 121 printf("Warning: you configured more ESDHC controller"
122 122 "(%d) as supported by the board(1)\n",
123 123 CONFIG_SYS_FSL_ESDHC_NUM);
124   - return status;
  124 + return -EINVAL;
125 125 }
126   - status |= fsl_esdhc_initialize(bis, &esdhc_cfg[index]);
  126 + ret = fsl_esdhc_initialize(bis, &esdhc_cfg[index]);
  127 + if (ret)
  128 + return ret;
127 129 }
128 130  
129   - return status;
  131 + return 0;
130 132 }
131 133 #endif
132 134