/* Read register */
int retval = mem_ap_read_atomic_u32(ap, self->spot.base + reg, &tmp);
- if (ERROR_OK != retval)
+ if (retval != ERROR_OK)
return retval;
/* clear bitfield */
{
struct adiv5_ap *ap = dap_ap(self->spot.dap, self->spot.ap_num);
- if (p_value == NULL)
+ if (!p_value)
return ERROR_COMMAND_ARGUMENT_INVALID;
return mem_ap_read_atomic_u32(ap, self->spot.base + reg, p_value);
/* parse config or cget options ... */
while (goi->argc > 0) {
int e = adiv5_jim_mem_ap_spot_configure(&cti->spot, goi);
+
+ if (e == JIM_CONTINUE)
+ Jim_SetResultFormatted(goi->interp, "unknown option '%s'",
+ Jim_String(goi->argv[0]));
+
if (e != JIM_OK)
- return e;
+ return JIM_ERR;
}
if (!cti->spot.dap) {
int e;
cmd_ctx = current_command_context(goi->interp);
- assert(cmd_ctx != NULL);
+ assert(cmd_ctx);
if (goi->argc < 3) {
Jim_WrongNumArgs(goi->interp, 1, goi->argv, "?name? ..options...");
/* COMMAND */
jim_getopt_obj(goi, &new_cmd);
/* does this command exist? */
- cmd = Jim_GetCommand(goi->interp, new_cmd, JIM_ERRMSG);
+ cmd = Jim_GetCommand(goi->interp, new_cmd, JIM_NONE);
if (cmd) {
cp = Jim_GetString(new_cmd, NULL);
Jim_SetResultFormatted(goi->interp, "Command: %s Exists", cp);
/* Create it */
cti = calloc(1, sizeof(*cti));
- if (cti == NULL)
+ if (!cti)
return JIM_ERR;
adiv5_mem_ap_spot_init(&cti->spot);
COMMAND_REGISTRATION_DONE
};
e = register_commands_with_data(cmd_ctx, NULL, cti_commands, cti);
- if (ERROR_OK != e)
+ if (e != ERROR_OK)
return JIM_ERR;
list_add_tail(&cti->lh, &all_cti);