Commit dd9d1a34 authored by David Brownell's avatar David Brownell
Browse files

misc code review updates



More updates from the code review by Steve Grubb <sgrubb@redhat.com>.
The Jim float-comparision bug just gets a comment not a fix, though.

Cc: Steve Grubb <sgrubb@redhat.com>.
Signed-off-by: default avatarDavid Brownell <dbrownell@users.sourceforge.net>
parent 12b67a2b
......@@ -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;
......
......@@ -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;
}
}
......
......@@ -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);
......
......@@ -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
{
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment