Commit e7eb277dced570f177d75d56f40219d9dc599ed1

Authored by Fabio Estevam
Committed by Stefano Babic
1 parent 612f2dc026

mx6boards: 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: Eric Benard <eric@eukrea.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/embest/mx6boards/mx6boards.c
... ... @@ -216,7 +216,7 @@
216 216  
217 217 int board_mmc_init(bd_t *bis)
218 218 {
219   - s32 status = 0;
  219 + int ret;
220 220 int i;
221 221  
222 222 /*
223 223  
224 224  
... ... @@ -268,13 +268,15 @@
268 268 printf("Warning: you configured more USDHC controllers"
269 269 "(%d) then supported by the board (%d)\n",
270 270 i + 1, CONFIG_SYS_FSL_USDHC_NUM);
271   - return status;
  271 + return -EINVAL;
272 272 }
273 273  
274   - status |= fsl_esdhc_initialize(bis, &usdhc_cfg[i]);
  274 + ret = fsl_esdhc_initialize(bis, &usdhc_cfg[i]);
  275 + if (ret)
  276 + return ret;
275 277 }
276 278  
277   - return status;
  279 + return 0;
278 280 }
279 281 #endif
280 282