From 469211b330aaa187de511a8e3963feac1db51053 Mon Sep 17 00:00:00 2001 From: barthess Date: Mon, 16 Apr 2012 20:14:08 +0000 Subject: [PATCH] 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-d51de3d6d3f4 --- os/hal/src/sdc.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/os/hal/src/sdc.c b/os/hal/src/sdc.c index d883eac39..96c1b4561 100644 --- a/os/hal/src/sdc.c +++ b/os/hal/src/sdc.c @@ -340,6 +340,10 @@ bool_t sdcConnect(SDCDriver *sdcp) { a = _sdc_get_slice(sdcp->csd, SDC_CSD_20_C_SIZE_SLICE); sdcp->capacity = 1024 * (a + 1); break; + default: + /* Reserved value detected. */ + sdcp->capacity = 0; + break; } if (sdcp->capacity == 0) goto failed;