SDC. Safety improvements in capacity detection code.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/branches/sdc_dev2@4104 35acf78f-673a-0410-8e92-d51de3d6d3f4master
parent
671cb8ab9d
commit
469211b330
|
@ -340,6 +340,10 @@ bool_t sdcConnect(SDCDriver *sdcp) {
|
||||||
a = _sdc_get_slice(sdcp->csd, SDC_CSD_20_C_SIZE_SLICE);
|
a = _sdc_get_slice(sdcp->csd, SDC_CSD_20_C_SIZE_SLICE);
|
||||||
sdcp->capacity = 1024 * (a + 1);
|
sdcp->capacity = 1024 * (a + 1);
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
/* Reserved value detected. */
|
||||||
|
sdcp->capacity = 0;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
if (sdcp->capacity == 0)
|
if (sdcp->capacity == 0)
|
||||||
goto failed;
|
goto failed;
|
||||||
|
|
Loading…
Reference in New Issue