diff options
author | Øyvind Harboe <oyvind.harboe@zylin.com> | 2010-05-05 09:32:03 +0200 |
---|---|---|
committer | Øyvind Harboe <oyvind.harboe@zylin.com> | 2010-05-05 15:24:24 +0200 |
commit | 3077f5845f197c5e21fc4ed917722297c74ef754 (patch) | |
tree | 053f943c03d635dbdeb33f67704830a6185d040e | |
parent | 2fba796e27fe37076380f90aa4df986db2b06685 (diff) | |
download | openocd+libswd-3077f5845f197c5e21fc4ed917722297c74ef754.tar.gz openocd+libswd-3077f5845f197c5e21fc4ed917722297c74ef754.tar.bz2 openocd+libswd-3077f5845f197c5e21fc4ed917722297c74ef754.tar.xz openocd+libswd-3077f5845f197c5e21fc4ed917722297c74ef754.zip |
cfi: fix error handling for protect fn
No error was propagated.
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
-rw-r--r-- | src/flash/nor/cfi.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/flash/nor/cfi.c b/src/flash/nor/cfi.c index 99676529..92b553b5 100644 --- a/src/flash/nor/cfi.c +++ b/src/flash/nor/cfi.c @@ -3,6 +3,7 @@ * Dominic.Rath@gmx.de * * Copyright (C) 2009 Michael Schwingen * * michael@schwingen.org * + * Copyright (C) 2010 Øyvind Harboe <oyvind.harboe@zylin.com> * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * @@ -887,6 +888,7 @@ static int cfi_protect(struct flash_bank *bank, int set, int first, int last) if ((first < 0) || (last < first) || (last >= bank->num_sectors)) { + LOG_ERROR("Invalid sector range"); return ERROR_FLASH_SECTOR_INVALID; } @@ -897,14 +899,12 @@ static int cfi_protect(struct flash_bank *bank, int set, int first, int last) { case 1: case 3: - cfi_intel_protect(bank, set, first, last); + return cfi_intel_protect(bank, set, first, last); break; default: LOG_ERROR("protect: cfi primary command set %i unsupported", cfi_info->pri_id); - break; + return ERROR_FAIL; } - - return ERROR_OK; } /* FIXME Replace this by a simple memcpy() - still unsure about sideeffects */ |