summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoroharboe <oharboe@b42882b7-edfa-0310-969c-e2dbd0fdcd60>2008-02-28 11:00:35 +0000
committeroharboe <oharboe@b42882b7-edfa-0310-969c-e2dbd0fdcd60>2008-02-28 11:00:35 +0000
commitfc37cdb2dd51ad79cf59e63139778f77af2a07b2 (patch)
treea2db5926e9eb9d681aa750dbb57fc4461982988d
parent5f159928b12af0b93d04d61edc2dda04254755ee (diff)
downloadopenocd+libswd-fc37cdb2dd51ad79cf59e63139778f77af2a07b2.tar.gz
openocd+libswd-fc37cdb2dd51ad79cf59e63139778f77af2a07b2.tar.bz2
openocd+libswd-fc37cdb2dd51ad79cf59e63139778f77af2a07b2.tar.xz
openocd+libswd-fc37cdb2dd51ad79cf59e63139778f77af2a07b2.zip
Pavel Chromy - cleanup error messages
git-svn-id: svn://svn.berlios.de/openocd/trunk@376 b42882b7-edfa-0310-969c-e2dbd0fdcd60
-rw-r--r--src/flash/flash.c51
1 files changed, 14 insertions, 37 deletions
diff --git a/src/flash/flash.c b/src/flash/flash.c
index 84d11586..96a74cd6 100644
--- a/src/flash/flash.c
+++ b/src/flash/flash.c
@@ -88,63 +88,40 @@ static int auto_erase = 0;
/* wafer thin wrapper for invoking the flash driver */
static int flash_driver_write(struct flash_bank_s *bank, u8 *buffer, u32 offset, u32 count)
{
- int retval=ERROR_OK;
- if (bank->target->state != TARGET_HALTED)
- {
- ERROR("target not halted - aborting flash write");
- retval=ERROR_TARGET_NOT_HALTED;
- } else
- {
- retval=bank->driver->write(bank, buffer, offset, count);
- }
+ int retval;
+
+ retval=bank->driver->write(bank, buffer, offset, count);
if (retval!=ERROR_OK)
{
- ERROR("Writing to flash bank at address 0x%08x at offset 0x%8.8x", bank->base, offset);
+ ERROR("error writing to flash at address 0x%08x at offset 0x%8.8x", bank->base, offset);
}
+
return retval;
}
static int flash_driver_erase(struct flash_bank_s *bank, int first, int last)
{
- int retval=ERROR_OK;
- if (bank->target->state != TARGET_HALTED)
- {
- ERROR("target not halted - aborting flash erase");
- retval=ERROR_TARGET_NOT_HALTED;
- } else if ((first < 0) || (last < first) || (last >= bank->num_sectors))
- {
- ERROR("invalid flash sector");
- retval=ERROR_FLASH_SECTOR_INVALID;
- } else
- {
- retval=bank->driver->erase(bank, first, last);
- }
+ int retval;
+
+ retval=bank->driver->erase(bank, first, last);
if (retval!=ERROR_OK)
{
- ERROR("Failed erasing banks %d to %d", first, last);
+ ERROR("failed erasing banks %d to %d", first, last);
}
+
return retval;
}
int flash_driver_protect(struct flash_bank_s *bank, int set, int first, int last)
{
int retval;
- if (bank->target->state != TARGET_HALTED)
- {
- ERROR("target not halted - aborting flash erase");
- retval=ERROR_TARGET_NOT_HALTED;
- } else if ((first < 0) || (last < first) || (last >= bank->num_sectors))
- {
- ERROR("invalid flash sector");
- retval=ERROR_FLASH_SECTOR_INVALID;
- } else
- {
- retval=bank->driver->protect(bank, set, first, last);
- }
+
+ retval=bank->driver->protect(bank, set, first, last);
if (retval!=ERROR_OK)
{
- ERROR("Failed protecting banks %d to %d", first, last);
+ ERROR("failed protecting banks %d to %d", first, last);
}
+
return retval;
}