Commit e37197acad30928b434c54842642b11ce5f3639b

Authored by Fabio Estevam
Committed by Stefano Babic
1 parent 44b9841d78

ot1200: 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.

Cc: Christian Gmeiner <christian.gmeiner@gmail.com>
Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>

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

board/bachmann/ot1200/ot1200.c
... ... @@ -173,7 +173,7 @@
173 173  
174 174 int board_mmc_init(bd_t *bis)
175 175 {
176   - s32 status = 0;
  176 + int ret;
177 177 u32 index = 0;
178 178  
179 179 usdhc_cfg[0].sdhc_clk = mxc_get_clock(MXC_ESDHC3_CLK);
180 180  
181 181  
... ... @@ -196,13 +196,15 @@
196 196 printf("Warning: you configured more USDHC controllers"
197 197 "(%d) then supported by the board (%d)\n",
198 198 index + 1, CONFIG_SYS_FSL_USDHC_NUM);
199   - return status;
  199 + return -EINVAL;
200 200 }
201 201  
202   - status |= fsl_esdhc_initialize(bis, &usdhc_cfg[index]);
  202 + ret = fsl_esdhc_initialize(bis, &usdhc_cfg[index]);
  203 + if (ret)
  204 + return ret;
203 205 }
204 206  
205   - return status;
  207 + return 0;
206 208 }
207 209  
208 210 #define PC MUX_PAD_CTRL(I2C_PAD_CTRL)