Hello, This is my last set of findings from looking through the code in svn. This set mostly concentrates on variable tests that are unnecessary or could be copy and paste issues.
In src/helper/jim.c at line 6066 we find this code: if (end) { then at 6071, we find this: } else if (!end && index < 0) The check for !end is unnecessary since the first check leaves no doubt that end is 0 if it gets to line 6071. -------------- src/helper/jim.c at line 7066 floats are being tested for equality. ------------- src/helper/jim.c at line 9877 is this code: if (varBObjPtr) { farther down within the same if we find this at line 9883: if (varBObjPtr) Nothing in between has changed its value. -------------- In src/jtag/core.c at line 717 we find this code: if (compare_failed) { then at line 726 we find another check of the same variable with only comments between the two checks. -------------- In src/svf/svf.c at line 1333 we find this code: if (NULL == path) { LOG_ERROR("not enough memory"); return ERROR_FAIL; Then farther down at line 1376 is if (NULL != path) Due to the check at line 1333, this is not necessary. --------------- In src/flash/flash.c at line 700, we find this code: if (retval != ERROR_OK) { image_close(&image); return retval; Then farther down at line 711, we find this: if (retval == ERROR_OK) Due to the check at 700, this will always be true. There is also a repeat of this problem at lines 826/831. --------------- In src/flash/davinci_nand.c at line 648 we find this code: chip = strtoul(argv[2], &ep, 0); if (*ep || chip == 0 || chip == ULONG_MAX) { LOG_ERROR("Invalid NAND chip address %s", argv[2]); goto fail; Then at line 665 we find this: aemif = strtoul(argv[4], &ep, 0); if (*ep || chip == 0 || chip == ULONG_MAX) { LOG_ERROR("Invalid AEMIF controller address %s", argv[4]); goto fail; Its checking chip again. Is that a copy and paste mistake? --------------- In src/flash/mflash.c at line 345 is this code: if ((ret = mg_dsk_wait(mg_io_wait_drq, MG_OEM_DISK_WAIT_TIME_NORMAL)) != ERROR_OK) return ret; Then at line 355 is this: if (ret != ERROR_OK) return ret; The check at line 345 should have made checking this again unnecessary. Was the call to target_read_memory supposed to have been checked or is this just left over code? ---------------- Best Regards, -Steve _______________________________________________ Openocd-development mailing list Openocd-development@lists.berlios.de https://lists.berlios.de/mailman/listinfo/openocd-development