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);
{
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)) ||
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;
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)