-
Bug
-
Resolution: Fixed
-
Medium
-
SITSW-4871
-
09.02.01
-
10.01.00
-
The following snippet in the MMCSD_initSD does not check the retry variable at the end for determining the status.
/* Send OCR - ACMD*/ if(SystemP_SUCCESS == status) { uint32_t ocrb31 = 0U; uint32_t retry = 0xFFFFU; while((ocrb31 == 0U) && (retry != 0U)) { MMCSD_initTransaction(&trans); trans.cmd = MMCSD_SD_CMD(55); status = MMCSD_transfer(handle, &trans); if(SystemP_SUCCESS == status) { /* Send ACMD41 */ MMCSD_initTransaction(&trans); trans.cmd = MMCSD_SD_ACMD(41); trans.arg = (1 << 30) | (0x01FFU << 15); /* 30th bit - High Cap, 24:15 bits - VDD wild card */ status = MMCSD_transfer(handle, &trans); } ocrb31 = (trans.response[0] & (1 << 31)); retry--; } if(retry == 0U) { status = SystemP_FAILURE; return status; } }
In case the retry is exhausted meaning the while loop ended because of retry = 0, the status still remain SystemP_SUCCESS. Instead, it should assign the status the FAILURE at the end if retry is 0.