nand: when verify failed, it didn't return an error
authorØyvind Harboe <oyvind.harboe@zylin.com>
Wed, 16 Jun 2010 05:39:46 +0000 (07:39 +0200)
committerØyvind Harboe <oyvind.harboe@zylin.com>
Wed, 16 Jun 2010 05:39:46 +0000 (07:39 +0200)
when the verify failed, it didn't return an error,
which breaks e.g. tcl scripts that rely on this for
exceptions to work.

Found by -Wshadow

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

index 1272bf62b50c706d0485c046c92d25d82433b73c..592277e446cc9cfa13b66e84579ca7c4587a77cf 100644 (file)
@@ -336,13 +336,14 @@ COMMAND_HANDLER(handle_nand_verify_command)
 
        while (file.size > 0)
        {
-               int retval = nand_read_page(nand, dev.address / dev.page_size,
+               retval = nand_read_page(nand, dev.address / dev.page_size,
                                dev.page, dev.page_size, dev.oob, dev.oob_size);
                if (ERROR_OK != retval)
                {
                        command_print(CMD_CTX, "reading NAND flash page failed");
                        nand_fileio_cleanup(&dev);
-                       return nand_fileio_cleanup(&file);
+                       nand_fileio_cleanup(&file);
+                       return retval;
                }
 
                int bytes_read = nand_fileio_read(nand, &file);
@@ -350,7 +351,8 @@ COMMAND_HANDLER(handle_nand_verify_command)
                {
                        command_print(CMD_CTX, "error while reading file");
                        nand_fileio_cleanup(&dev);
-                       return nand_fileio_cleanup(&file);
+                       nand_fileio_cleanup(&file);
+                       return ERROR_FAIL;
                }
 
                if ((dev.page && memcmp(dev.page, file.page, dev.page_size)) ||
@@ -359,7 +361,8 @@ COMMAND_HANDLER(handle_nand_verify_command)
                        command_print(CMD_CTX, "NAND flash contents differ "
                                                "at 0x%8.8" PRIx32, dev.address);
                        nand_fileio_cleanup(&dev);
-                       return nand_fileio_cleanup(&file);
+                       nand_fileio_cleanup(&file);
+                       return ERROR_FAIL;
                }
 
                file.size -= bytes_read;
@@ -389,12 +392,13 @@ COMMAND_HANDLER(handle_nand_dump_command)
        while (s.size > 0)
        {
                size_t size_written;
-               int retval = nand_read_page(nand, s.address / nand->page_size,
+               retval = nand_read_page(nand, s.address / nand->page_size,
                                s.page, s.page_size, s.oob, s.oob_size);
                if (ERROR_OK != retval)
                {
                        command_print(CMD_CTX, "reading NAND flash page failed");
-                       return nand_fileio_cleanup(&s);
+                       nand_fileio_cleanup(&s);
+                       return retval;
                }
 
                if (NULL != s.page)

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)