check if flash erase failed (#2543)
* check flash erase result * format * string * s
This commit is contained in:
parent
2a754c6e3f
commit
70283f42c1
|
@ -89,7 +89,12 @@ void writeToFlashIfPending() {
|
|||
template <typename TStorage>
|
||||
int eraseAndFlashCopy(flashaddr_t storageAddress, const TStorage& data)
|
||||
{
|
||||
intFlashErase(storageAddress, sizeof(TStorage));
|
||||
auto err = intFlashErase(storageAddress, sizeof(TStorage));
|
||||
if (FLASH_RETURN_SUCCESS != err) {
|
||||
firmwareError(OBD_PCM_Processor_Fault, "Failed to erase flash at %#010x", storageAddress);
|
||||
return err;
|
||||
}
|
||||
|
||||
return intFlashWrite(storageAddress, reinterpret_cast<const char*>(&data), sizeof(TStorage));
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue