nand: when verify failed, it didn't return an error
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>
This commit is contained in:
parent
72d227cd5e
commit
6de2b2d14b
|
@ -336,13 +336,14 @@ COMMAND_HANDLER(handle_nand_verify_command)
|
||||||
|
|
||||||
while (file.size > 0)
|
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);
|
dev.page, dev.page_size, dev.oob, dev.oob_size);
|
||||||
if (ERROR_OK != retval)
|
if (ERROR_OK != retval)
|
||||||
{
|
{
|
||||||
command_print(CMD_CTX, "reading NAND flash page failed");
|
command_print(CMD_CTX, "reading NAND flash page failed");
|
||||||
nand_fileio_cleanup(&dev);
|
nand_fileio_cleanup(&dev);
|
||||||
return nand_fileio_cleanup(&file);
|
nand_fileio_cleanup(&file);
|
||||||
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
int bytes_read = nand_fileio_read(nand, &file);
|
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");
|
command_print(CMD_CTX, "error while reading file");
|
||||||
nand_fileio_cleanup(&dev);
|
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)) ||
|
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 "
|
command_print(CMD_CTX, "NAND flash contents differ "
|
||||||
"at 0x%8.8" PRIx32, dev.address);
|
"at 0x%8.8" PRIx32, dev.address);
|
||||||
nand_fileio_cleanup(&dev);
|
nand_fileio_cleanup(&dev);
|
||||||
return nand_fileio_cleanup(&file);
|
nand_fileio_cleanup(&file);
|
||||||
|
return ERROR_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
file.size -= bytes_read;
|
file.size -= bytes_read;
|
||||||
|
@ -389,12 +392,13 @@ COMMAND_HANDLER(handle_nand_dump_command)
|
||||||
while (s.size > 0)
|
while (s.size > 0)
|
||||||
{
|
{
|
||||||
size_t size_written;
|
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);
|
s.page, s.page_size, s.oob, s.oob_size);
|
||||||
if (ERROR_OK != retval)
|
if (ERROR_OK != retval)
|
||||||
{
|
{
|
||||||
command_print(CMD_CTX, "reading NAND flash page failed");
|
command_print(CMD_CTX, "reading NAND flash page failed");
|
||||||
return nand_fileio_cleanup(&s);
|
nand_fileio_cleanup(&s);
|
||||||
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (NULL != s.page)
|
if (NULL != s.page)
|
||||||
|
|
Loading…
Reference in New Issue