From: Øyvind Harboe Date: Wed, 5 May 2010 07:32:03 +0000 (+0200) Subject: cfi: fix error handling for protect fn X-Git-Tag: v0.5.0-rc1~715 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=3077f5845f197c5e21fc4ed917722297c74ef754;p=openocd cfi: fix error handling for protect fn No error was propagated. Signed-off-by: Øyvind Harboe --- 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 * * * * 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 */