From: David B. <dbr...@us...> - 2009-12-05 23:41:09
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via dd9d1a3459f7b38e2af99bdbafd322cacc9dacc2 (commit) from 12b67a2b41557160b8daa23305cbc30a349588c1 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit dd9d1a3459f7b38e2af99bdbafd322cacc9dacc2 Author: David Brownell <dbr...@us...> Date: Sat Dec 5 14:40:06 2009 -0800 misc code review updates More updates from the code review by Steve Grubb <sg...@re...>. The Jim float-comparision bug just gets a comment not a fix, though. Cc: Steve Grubb <sg...@re...>. Signed-off-by: David Brownell <dbr...@us...> diff --git a/src/flash/mflash.c b/src/flash/mflash.c index aa02e15..123d61c 100644 --- a/src/flash/mflash.c +++ b/src/flash/mflash.c @@ -342,7 +342,8 @@ static int mg_dsk_drv_info(void) if ((ret = mg_dsk_io_cmd(0, 1, mg_io_cmd_identify)) != ERROR_OK) return ret; - if ((ret = mg_dsk_wait(mg_io_wait_drq, MG_OEM_DISK_WAIT_TIME_NORMAL)) != ERROR_OK) + ret = mg_dsk_wait(mg_io_wait_drq, MG_OEM_DISK_WAIT_TIME_NORMAL); + if (ret != ERROR_OK) return ret; LOG_INFO("mflash: read drive info"); @@ -350,7 +351,8 @@ static int mg_dsk_drv_info(void) if (! mflash_bank->drv_info) mflash_bank->drv_info = malloc(sizeof(struct mg_drv_info)); - target_read_memory(target, mg_buff, 2, sizeof(mg_io_type_drv_info) >> 1, + ret = target_read_memory(target, mg_buff, 2, + sizeof(mg_io_type_drv_info) >> 1, (uint8_t *)&mflash_bank->drv_info->drv_id); if (ret != ERROR_OK) return ret; diff --git a/src/helper/jim.c b/src/helper/jim.c index 117ec56..c04acf0 100644 --- a/src/helper/jim.c +++ b/src/helper/jim.c @@ -6077,7 +6077,7 @@ int SetIndexFromAny(Jim_Interp *interp, Jim_Obj *objPtr) index = INT_MAX; else index = -(index + 1); - } else if (!end && index < 0) + } else if (index < 0) index = -INT_MAX; /* Free the old internal repr and set the new one. */ Jim_FreeIntRep(interp, objPtr); @@ -7063,7 +7063,6 @@ trydouble: "Got floating-point value where integer was expected", -1); error = 1; goto err; - break; case JIM_EXPROP_ADD: dC = dA + dB; break; case JIM_EXPROP_SUB: dC = dA-dB; break; case JIM_EXPROP_MUL: dC = dA*dB; break; @@ -7071,6 +7070,7 @@ trydouble: case JIM_EXPROP_GT: dC = dA > dB; break; case JIM_EXPROP_LTE: dC = dA <= dB; break; case JIM_EXPROP_GTE: dC = dA >= dB; break; + /* FIXME comparing floats for equality/inequality is bad juju */ case JIM_EXPROP_NUMEQ: dC = dA == dB; break; case JIM_EXPROP_NUMNE: dC = dA != dB; break; case JIM_EXPROP_LOGICAND_LEFT: @@ -9889,8 +9889,7 @@ static int Jim_WhileCoreCommand(Jim_Interp *interp, int argc, Jim_GetWide(interp, objPtr, &wideValueB) != JIM_OK) { Jim_DecrRefCount(interp, varAObjPtr); - if (varBObjPtr) - Jim_DecrRefCount(interp, varBObjPtr); + Jim_DecrRefCount(interp, varBObjPtr); goto noopt; } } diff --git a/src/jtag/core.c b/src/jtag/core.c index 433b50b..373dd7e 100644 --- a/src/jtag/core.c +++ b/src/jtag/core.c @@ -762,8 +762,7 @@ static int jtag_check_value_inner(uint8_t *captured, uint8_t *in_check_value, uint8_t *in_check_mask, int num_bits) { int retval = ERROR_OK; - - int compare_failed = 0; + int compare_failed; if (in_check_mask) compare_failed = buf_cmp_mask(captured, in_check_value, in_check_mask, num_bits); diff --git a/src/svf/svf.c b/src/svf/svf.c index e6d842b..1c746f3 100644 --- a/src/svf/svf.c +++ b/src/svf/svf.c @@ -1350,12 +1350,9 @@ static int svf_run_command(struct command_context *cmd_ctx, char *cmd_str) return ERROR_FAIL; } } - // no need to keep this memory, in jtag_add_pathmove, path will be duplicated - if (NULL != path) - { - free(path); - path = NULL; - } + + free(path); + path = NULL; } else { ----------------------------------------------------------------------- Summary of changes: src/flash/mflash.c | 6 ++++-- src/helper/jim.c | 7 +++---- src/jtag/core.c | 3 +-- src/svf/svf.c | 9 +++------ 4 files changed, 11 insertions(+), 14 deletions(-) hooks/post-receive -- Main OpenOCD repository |