cfi: fix error handling for protect fn
authorØyvind Harboe <oyvind.harboe@zylin.com>
Wed, 5 May 2010 07:32:03 +0000 (09:32 +0200)
committerØyvind Harboe <oyvind.harboe@zylin.com>
Wed, 5 May 2010 13:24:24 +0000 (15:24 +0200)
No error was propagated.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
src/flash/nor/cfi.c

index 99676529ba3958c15a09cb21c33e0d2ce74cdd35..92b553b54bfeb56b52648047f6a180433cfe863f 100644 (file)
@@ -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 */

Linking to existing account procedure

If you already have an account and want to add another login method you MUST first sign in with your existing account and then change URL to read https://review.openocd.org/login/?link to get to this page again but this time it'll work for linking. Thank you.

SSH host keys fingerprints

1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=..              |
|+o..   .         |
|*.o   . .        |
|+B . . .         |
|Bo. = o S        |
|Oo.+ + =         |
|oB=.* = . o      |
| =+=.+   + E     |
|. .=o   . o      |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)