mirror of https://github.com/ARMmbed/mbed-os.git
Error handling for CMD9
parent
cdbbea6c52
commit
21e6f47aa4
|
@ -344,6 +344,11 @@ int SDBlockDevice::init()
|
|||
}
|
||||
debug_if(SD_DBG, "init card = %d\n", _is_initialized);
|
||||
_sectors = _sd_sectors();
|
||||
// CMD9 failed
|
||||
if (0 == _sectors) {
|
||||
_lock.unlock();
|
||||
return BD_ERROR_DEVICE_ERROR;
|
||||
}
|
||||
|
||||
// Set block length to 512 (CMD16)
|
||||
if (_cmd(CMD16_SET_BLOCKLEN, _block_size) != 0) {
|
||||
|
@ -358,12 +363,10 @@ int SDBlockDevice::init()
|
|||
_lock.unlock();
|
||||
return err;
|
||||
}
|
||||
|
||||
_lock.unlock();
|
||||
return BD_ERROR_OK;
|
||||
}
|
||||
|
||||
|
||||
int SDBlockDevice::deinit()
|
||||
{
|
||||
return 0;
|
||||
|
|
Loading…
Reference in New Issue