X-Git-Url: https://review.openocd.org/gitweb?p=openocd.git;a=blobdiff_plain;f=src%2Fflash%2Fnand%2Flpc3180.c;h=d15fdce384a40853af72963b006aa7649b832424;hp=1b5306701b66e256cbde8ab4a8f40b71de56739b;hb=d0e763ac7ef6aa17b17bd00ccdfbccfb4eacda69;hpb=fab0dcd7e6cb8cfbf63cb41f0978902371d30205 diff --git a/src/flash/nand/lpc3180.c b/src/flash/nand/lpc3180.c index 1b5306701b..d15fdce384 100644 --- a/src/flash/nand/lpc3180.c +++ b/src/flash/nand/lpc3180.c @@ -16,9 +16,7 @@ * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + * along with this program. If not, see . * ***************************************************************************/ #ifdef HAVE_CONFIG_H @@ -524,8 +522,9 @@ static int lpc3180_write_page(struct nand_device *nand, target_write_u32(target, 0x200b8010, 0x0); if (!lpc3180_controller_ready(nand, 1000)) { - LOG_ERROR( - "timeout while waiting for completion of auto encode cycle"); + LOG_ERROR("timeout while waiting for completion of auto encode cycle"); + free(page_buffer); + free(oob_buffer); return ERROR_NAND_OPERATION_FAILED; } } @@ -536,11 +535,15 @@ static int lpc3180_write_page(struct nand_device *nand, retval = nand_read_status(nand, &status); if (retval != ERROR_OK) { LOG_ERROR("couldn't read status"); + free(page_buffer); + free(oob_buffer); return ERROR_NAND_OPERATION_FAILED; } if (status & NAND_STATUS_FAIL) { LOG_ERROR("write operation didn't pass, status: 0x%2.2x", status); + free(page_buffer); + free(oob_buffer); return ERROR_NAND_OPERATION_FAILED; } @@ -888,8 +891,9 @@ static int lpc3180_read_page(struct nand_device *nand, target_write_u32(target, 0x200b8014, 0xaa55aa55); if (!lpc3180_controller_ready(nand, 1000)) { - LOG_ERROR( - "timeout while waiting for completion of auto decode cycle"); + LOG_ERROR("timeout while waiting for completion of auto decode cycle"); + free(page_buffer); + free(oob_buffer); return ERROR_NAND_OPERATION_FAILED; } @@ -899,6 +903,8 @@ static int lpc3180_read_page(struct nand_device *nand, if (mlc_isr & 0x40) { LOG_ERROR("uncorrectable error detected: 0x%2.2x", (unsigned)mlc_isr); + free(page_buffer); + free(oob_buffer); return ERROR_NAND_OPERATION_FAILED; }