This is an automated email from Gerrit. "Antonio Borneo <[email protected]>" just uploaded a new patch set to Gerrit, which you can find at https://review.openocd.org/c/openocd/+/9476
-- gerrit commit dc58ea5c5094d1462d54745f5c57e0675340c49d Author: Antonio Borneo <[email protected]> Date: Sun Feb 22 15:39:36 2026 +0100 openocd: trivial switch to LOG_ERROR_OUT_OF_MEMORY() For lines matching LOG_ERROR("Out of memory"); convert them to use LOG_ERROR_OUT_OF_MEMORY(); Conversion done automatically with: sed -i 's/LOG_ERROR("Out of memory")/LOG_ERROR_OUT_OF_MEMORY()/' \ $(git ls-files src) Change-Id: I1e6c22044855198a48b6614e12cc0aac66db501c Signed-off-by: Antonio Borneo <[email protected]> diff --git a/src/flash/nor/cfi.c b/src/flash/nor/cfi.c index 108b66750c..c497cea2ad 100644 --- a/src/flash/nor/cfi.c +++ b/src/flash/nor/cfi.c @@ -416,7 +416,7 @@ static int cfi_read_intel_pri_ext(struct flash_bank *bank) pri_ext = malloc(sizeof(struct cfi_intel_pri_ext)); if (!pri_ext) { - LOG_ERROR("Out of memory"); + LOG_ERROR_OUT_OF_MEMORY(); return ERROR_FAIL; } cfi_info->pri_ext = pri_ext; @@ -512,7 +512,7 @@ static int cfi_read_spansion_pri_ext(struct flash_bank *bank) pri_ext = malloc(sizeof(struct cfi_spansion_pri_ext)); if (!pri_ext) { - LOG_ERROR("Out of memory"); + LOG_ERROR_OUT_OF_MEMORY(); return ERROR_FAIL; } cfi_info->pri_ext = pri_ext; @@ -614,7 +614,7 @@ static int cfi_read_atmel_pri_ext(struct flash_bank *bank) pri_ext = malloc(sizeof(struct cfi_spansion_pri_ext)); if (!pri_ext) { - LOG_ERROR("Out of memory"); + LOG_ERROR_OUT_OF_MEMORY(); return ERROR_FAIL; } @@ -1472,7 +1472,7 @@ static int cfi_spansion_write_block_mips(struct flash_bank *bank, const uint8_t /* convert bus-width dependent algorithm code to correct endianness */ target_code = malloc(target_code_size); if (!target_code) { - LOG_ERROR("Out of memory"); + LOG_ERROR_OUT_OF_MEMORY(); return ERROR_FAIL; } @@ -1851,7 +1851,7 @@ static int cfi_spansion_write_block(struct flash_bank *bank, const uint8_t *buff /* convert bus-width dependent algorithm code to correct endianness */ target_code = malloc(target_code_size); if (!target_code) { - LOG_ERROR("Out of memory"); + LOG_ERROR_OUT_OF_MEMORY(); return ERROR_FAIL; } diff --git a/src/flash/nor/npcx.c b/src/flash/nor/npcx.c index 8309630d7c..bc4ceeeba4 100644 --- a/src/flash/nor/npcx.c +++ b/src/flash/nor/npcx.c @@ -257,7 +257,7 @@ static int npcx_probe(struct flash_bank *bank) bank->sectors = calloc(num_sectors, sizeof(struct flash_sector)); if (!bank->sectors) { - LOG_ERROR("Out of memory"); + LOG_ERROR_OUT_OF_MEMORY(); return ERROR_FAIL; } @@ -301,7 +301,7 @@ FLASH_BANK_COMMAND_HANDLER(npcx_flash_bank_command) npcx_bank = calloc(1, sizeof(struct npcx_flash_bank)); if (!npcx_bank) { - LOG_ERROR("Out of memory"); + LOG_ERROR_OUT_OF_MEMORY(); return ERROR_FAIL; } diff --git a/src/flash/nor/pic32mx.c b/src/flash/nor/pic32mx.c index 59e67cfe22..66591525aa 100644 --- a/src/flash/nor/pic32mx.c +++ b/src/flash/nor/pic32mx.c @@ -504,7 +504,7 @@ static int pic32mx_write_block(struct flash_bank *bank, const uint8_t *buffer, if (row_offset && (count >= (row_size / 4))) { new_buffer = malloc(buffer_size); if (!new_buffer) { - LOG_ERROR("Out of memory"); + LOG_ERROR_OUT_OF_MEMORY(); return ERROR_FAIL; } memset(new_buffer, 0xff, row_offset); diff --git a/src/flash/nor/stm32f2x.c b/src/flash/nor/stm32f2x.c index 5276d323c9..bf5c53cd17 100644 --- a/src/flash/nor/stm32f2x.c +++ b/src/flash/nor/stm32f2x.c @@ -251,7 +251,7 @@ FLASH_BANK_COMMAND_HANDLER(stm32x_flash_bank_command) stm32x_info = malloc(sizeof(struct stm32x_flash_bank)); if (!stm32x_info) { - LOG_ERROR("Out of memory"); + LOG_ERROR_OUT_OF_MEMORY(); return ERROR_FAIL; } bank->driver_priv = stm32x_info; diff --git a/src/flash/nor/tcl.c b/src/flash/nor/tcl.c index add7df4376..5808a8ef42 100644 --- a/src/flash/nor/tcl.c +++ b/src/flash/nor/tcl.c @@ -909,7 +909,7 @@ COMMAND_HANDLER(handle_flash_write_bank_command) buffer = malloc(aligned_size); if (!buffer) { fileio_close(fileio); - LOG_ERROR("Out of memory"); + LOG_ERROR_OUT_OF_MEMORY(); return ERROR_FAIL; } @@ -1006,7 +1006,7 @@ COMMAND_HANDLER(handle_flash_read_bank_command) buffer = malloc(length); if (!buffer) { - LOG_ERROR("Out of memory"); + LOG_ERROR_OUT_OF_MEMORY(); return ERROR_FAIL; } @@ -1100,7 +1100,7 @@ COMMAND_HANDLER(handle_flash_verify_bank_command) buffer_file = malloc(length); if (!buffer_file) { - LOG_ERROR("Out of memory"); + LOG_ERROR_OUT_OF_MEMORY(); fileio_close(fileio); return ERROR_FAIL; } @@ -1121,7 +1121,7 @@ COMMAND_HANDLER(handle_flash_verify_bank_command) buffer_flash = malloc(length); if (!buffer_flash) { - LOG_ERROR("Out of memory"); + LOG_ERROR_OUT_OF_MEMORY(); free(buffer_file); return ERROR_FAIL; } diff --git a/src/helper/command.c b/src/helper/command.c index bf2c91814e..792f4d579f 100644 --- a/src/helper/command.c +++ b/src/helper/command.c @@ -370,7 +370,7 @@ static void command_vprint(struct command_invocation *cmd, return; alloc_error: - LOG_ERROR("Out of memory"); + LOG_ERROR_OUT_OF_MEMORY(); free(cmd->output); cmd->output = CMD_PRINT_OOM; } @@ -427,7 +427,7 @@ static int jim_exec_command(Jim_Interp *interp, struct command_context *context, /* use c->handler */ const char **words = malloc(argc * sizeof(char *)); if (!words) { - LOG_ERROR("Out of memory"); + LOG_ERROR_OUT_OF_MEMORY(); return JIM_ERR; } @@ -628,7 +628,7 @@ static void tcl_output(void *privData, const char *file, unsigned int line, state->output = alloc_printf("%s%s", old ? old : "", string); free(old); if (!state->output) - LOG_ERROR("Out of memory"); + LOG_ERROR_OUT_OF_MEMORY(); } /* @@ -771,7 +771,7 @@ static COMMAND_HELPER(command_help_show, struct help_entry *c, msg = alloc_printf("%s", c->help ? c->help : ""); if (!msg) { - LOG_ERROR("Out of memory"); + LOG_ERROR_OUT_OF_MEMORY(); return ERROR_FAIL; } @@ -817,7 +817,7 @@ static char *alloc_concatenate_strings(int argc, const char **argv) char *all = strdup(argv[0]); if (!all) { - LOG_ERROR("Out of memory"); + LOG_ERROR_OUT_OF_MEMORY(); return NULL; } @@ -826,7 +826,7 @@ static char *alloc_concatenate_strings(int argc, const char **argv) all = alloc_printf("%s %s", all, argv[i]); free(prev); if (!all) { - LOG_ERROR("Out of memory"); + LOG_ERROR_OUT_OF_MEMORY(); return NULL; } } @@ -991,12 +991,12 @@ static int help_add_command(struct command_context *cmd_ctx, if (cmp) { entry = calloc(1, sizeof(*entry)); if (!entry) { - LOG_ERROR("Out of memory"); + LOG_ERROR_OUT_OF_MEMORY(); return ERROR_FAIL; } entry->cmd_name = strdup(cmd_name); if (!entry->cmd_name) { - LOG_ERROR("Out of memory"); + LOG_ERROR_OUT_OF_MEMORY(); free(entry); return ERROR_FAIL; } @@ -1008,7 +1008,7 @@ static int help_add_command(struct command_context *cmd_ctx, if (help_text) { char *text = strdup(help_text); if (!text) { - LOG_ERROR("Out of memory"); + LOG_ERROR_OUT_OF_MEMORY(); return ERROR_FAIL; } free(entry->help); @@ -1018,7 +1018,7 @@ static int help_add_command(struct command_context *cmd_ctx, if (usage_text) { char *text = strdup(usage_text); if (!text) { - LOG_ERROR("Out of memory"); + LOG_ERROR_OUT_OF_MEMORY(); return ERROR_FAIL; } free(entry->usage); diff --git a/src/jtag/drivers/angie.c b/src/jtag/drivers/angie.c index 6d8dc2c3b1..feeb0734d8 100644 --- a/src/jtag/drivers/angie.c +++ b/src/jtag/drivers/angie.c @@ -512,7 +512,7 @@ static int angie_load_firmware(struct angie *device, const char *filename) uint8_t *data = malloc(ANGIE_FW_SECTION_SIZE); if (!data) { - LOG_ERROR("Out of memory"); + LOG_ERROR_OUT_OF_MEMORY(); return ERROR_FAIL; } @@ -853,7 +853,7 @@ static int angie_jtag_execute_scan(struct angie *device, // queue read back buffer for further processing struct read_queue_entry *entry = malloc(sizeof(*entry)); if (!entry) { - LOG_ERROR("Out of memory"); + LOG_ERROR_OUT_OF_MEMORY(); free(buffer); return ERROR_FAIL; } diff --git a/src/jtag/drivers/at91rm9200.c b/src/jtag/drivers/at91rm9200.c index ddcf857a6b..b69ec82058 100644 --- a/src/jtag/drivers/at91rm9200.c +++ b/src/jtag/drivers/at91rm9200.c @@ -160,7 +160,7 @@ COMMAND_HANDLER(at91rm9200_handle_device_command) if (!at91rm9200_device) { at91rm9200_device = malloc(strlen(CMD_ARGV[0]) + sizeof(char)); if (!at91rm9200_device) { - LOG_ERROR("Out of memory"); + LOG_ERROR_OUT_OF_MEMORY(); return ERROR_FAIL; } strcpy(at91rm9200_device, CMD_ARGV[0]); diff --git a/src/jtag/drivers/linuxspidev.c b/src/jtag/drivers/linuxspidev.c index 396f1a19a9..f8c9a4a7ad 100644 --- a/src/jtag/drivers/linuxspidev.c +++ b/src/jtag/drivers/linuxspidev.c @@ -544,7 +544,7 @@ COMMAND_HANDLER(spidev_handle_path_command) free(spi_path); spi_path = strdup(CMD_ARGV[0]); if (!spi_path) { - LOG_ERROR("Out of memory"); + LOG_ERROR_OUT_OF_MEMORY(); return ERROR_FAIL; } diff --git a/src/jtag/drivers/nulink_usb.c b/src/jtag/drivers/nulink_usb.c index 66cf25a6d1..a401002f8d 100644 --- a/src/jtag/drivers/nulink_usb.c +++ b/src/jtag/drivers/nulink_usb.c @@ -1042,7 +1042,7 @@ static int nulink_usb_open(struct hl_interface_param *param, void **fd) struct nulink_usb_handle *h = calloc(1, sizeof(*h)); if (!h) { - LOG_ERROR("Out of memory"); + LOG_ERROR_OUT_OF_MEMORY(); goto error_open; } @@ -1052,7 +1052,7 @@ static int nulink_usb_open(struct hl_interface_param *param, void **fd) target_serial = calloc(len + 1, sizeof(wchar_t)); if (!target_serial) { - LOG_ERROR("Out of memory"); + LOG_ERROR_OUT_OF_MEMORY(); goto error_open; } diff --git a/src/jtag/swim.c b/src/jtag/swim.c index 004a9fd4f2..5ad4434fa5 100644 --- a/src/jtag/swim.c +++ b/src/jtag/swim.c @@ -62,7 +62,7 @@ COMMAND_HANDLER(handle_swim_newtap_command) tap = calloc(1, sizeof(*tap)); if (!tap) { - LOG_ERROR("Out of memory"); + LOG_ERROR_OUT_OF_MEMORY(); return ERROR_FAIL; } @@ -70,7 +70,7 @@ COMMAND_HANDLER(handle_swim_newtap_command) tap->tapname = strdup(CMD_ARGV[1]); tap->dotted_name = alloc_printf("%s.%s", CMD_ARGV[0], CMD_ARGV[1]); if (!tap->chip || !tap->tapname || !tap->dotted_name) { - LOG_ERROR("Out of memory"); + LOG_ERROR_OUT_OF_MEMORY(); free(tap->dotted_name); free(tap->tapname); free(tap->chip); diff --git a/src/jtag/tcl.c b/src/jtag/tcl.c index 9cffd6b5d1..35b9c6070d 100644 --- a/src/jtag/tcl.c +++ b/src/jtag/tcl.c @@ -84,7 +84,7 @@ static COMMAND_HELPER(handle_jtag_command_drscan_fields, struct scan_field *fiel void *t = malloc(DIV_ROUND_UP(bits, 8)); if (!t) { - LOG_ERROR("Out of memory"); + LOG_ERROR_OUT_OF_MEMORY(); return ERROR_FAIL; } @@ -144,7 +144,7 @@ COMMAND_HANDLER(handle_jtag_command_drscan) unsigned int num_fields = (CMD_ARGC - 1) / 2; struct scan_field *fields = calloc(num_fields, sizeof(struct scan_field)); if (!fields) { - LOG_ERROR("Out of memory"); + LOG_ERROR_OUT_OF_MEMORY(); return ERROR_FAIL; } @@ -283,7 +283,7 @@ static int jtag_tap_set_event(struct command_context *cmd_ctx, struct jtag_tap * if (!jteap) { jteap = calloc(1, sizeof(*jteap)); if (!jteap) { - LOG_ERROR("Out of memory"); + LOG_ERROR_OUT_OF_MEMORY(); return ERROR_FAIL; } @@ -395,7 +395,7 @@ static COMMAND_HELPER(handle_jtag_newtap_args, struct jtag_tap *tap) tap->tapname = strdup(CMD_ARGV[1]); tap->dotted_name = alloc_printf("%s.%s", CMD_ARGV[0], CMD_ARGV[1]); if (!tap->chip || !tap->tapname || !tap->dotted_name) { - LOG_ERROR("Out of memory"); + LOG_ERROR_OUT_OF_MEMORY(); return ERROR_FAIL; } CMD_ARGC -= 2; @@ -432,7 +432,7 @@ static COMMAND_HELPER(handle_jtag_newtap_args, struct jtag_tap *tap) tap->expected_ids = realloc(tap->expected_ids, (tap->expected_ids_cnt + 1) * sizeof(uint32_t)); if (!tap->expected_ids) { - LOG_ERROR("Out of memory"); + LOG_ERROR_OUT_OF_MEMORY(); return ERROR_FAIL; } @@ -515,7 +515,7 @@ __COMMAND_HANDLER(handle_jtag_newtap) { struct jtag_tap *tap = calloc(1, sizeof(struct jtag_tap)); if (!tap) { - LOG_ERROR("Out of memory"); + LOG_ERROR_OUT_OF_MEMORY(); return ERROR_FAIL; } @@ -973,7 +973,7 @@ COMMAND_HANDLER(handle_irscan_command) fields[i].num_bits = field_size; uint8_t *v = calloc(1, DIV_ROUND_UP(field_size, 8)); if (!v) { - LOG_ERROR("Out of memory"); + LOG_ERROR_OUT_OF_MEMORY(); goto error_return; } diff --git a/src/pld/efinix.c b/src/pld/efinix.c index b6e5f9e477..cf29395bbe 100644 --- a/src/pld/efinix.c +++ b/src/pld/efinix.c @@ -63,7 +63,7 @@ static int efinix_read_bit_file(struct raw_bit_file *bit_file, const char *filen bit_file->data = malloc(bit_file->length); if (!bit_file->data) { fclose(input_file); - LOG_ERROR("Out of memory"); + LOG_ERROR_OUT_OF_MEMORY(); return ERROR_PLD_FILE_LOAD_FAILED; } @@ -126,7 +126,7 @@ static int efinix_set_instr(struct jtag_tap *tap, uint8_t new_instr) field.num_bits = tap->ir_length; void *t = calloc(DIV_ROUND_UP(field.num_bits, 8), 1); if (!t) { - LOG_ERROR("Out of memory"); + LOG_ERROR_OUT_OF_MEMORY(); return ERROR_FAIL; } field.out_value = t; @@ -180,7 +180,7 @@ static int efinix_load(struct pld_device *pld_device, const char *filename) uint8_t *buf = calloc(TRAILING_ZEROS / 8, 1); if (!buf) { free(bit_file.data); - LOG_ERROR("Out of memory"); + LOG_ERROR_OUT_OF_MEMORY(); return ERROR_FAIL; } field[1].out_value = buf; @@ -286,7 +286,7 @@ PLD_CREATE_COMMAND_HANDLER(efinix_pld_create_command) struct efinix_pld_device *efinix_info = malloc(sizeof(struct efinix_pld_device)); if (!efinix_info) { - LOG_ERROR("Out of memory"); + LOG_ERROR_OUT_OF_MEMORY(); return ERROR_FAIL; } efinix_info->tap = tap; diff --git a/src/pld/gatemate.c b/src/pld/gatemate.c index f35b39ad21..347ac36254 100644 --- a/src/pld/gatemate.c +++ b/src/pld/gatemate.c @@ -37,7 +37,7 @@ static int gatemate_add_byte_to_bitfile(struct gatemate_bit_file *bit_file, uint else buffer = malloc(chunk_size); if (!buffer) { - LOG_ERROR("Out of memory"); + LOG_ERROR_OUT_OF_MEMORY(); return ERROR_FAIL; } bit_file->raw_file.data = buffer; @@ -90,7 +90,7 @@ static int gatemate_getline(char **buffer, size_t *buf_size, FILE *input_file) else new_buffer = malloc(chunk_size); if (!new_buffer) { - LOG_ERROR("Out of memory"); + LOG_ERROR_OUT_OF_MEMORY(); return -1; } *buffer = new_buffer; @@ -165,7 +165,7 @@ static int gatemate_set_instr(struct jtag_tap *tap, uint8_t new_instr) field.num_bits = tap->ir_length; void *t = calloc(DIV_ROUND_UP(field.num_bits, 8), 1); if (!t) { - LOG_ERROR("Out of memory"); + LOG_ERROR_OUT_OF_MEMORY(); return ERROR_FAIL; } field.out_value = t; @@ -287,7 +287,7 @@ PLD_CREATE_COMMAND_HANDLER(gatemate_pld_create_command) struct gatemate_pld_device *gatemate_info = malloc(sizeof(struct gatemate_pld_device)); if (!gatemate_info) { - LOG_ERROR("Out of memory"); + LOG_ERROR_OUT_OF_MEMORY(); return ERROR_FAIL; } gatemate_info->tap = tap; diff --git a/src/pld/gowin.c b/src/pld/gowin.c index bbc2fe15f6..c0944553a4 100644 --- a/src/pld/gowin.c +++ b/src/pld/gowin.c @@ -69,7 +69,7 @@ static int gowin_add_byte_to_bit_file(struct gowin_bit_file *bit_file, uint8_t b else buffer = malloc(8192); if (!buffer) { - LOG_ERROR("Out of memory"); + LOG_ERROR_OUT_OF_MEMORY(); return ERROR_FAIL; } bit_file->raw_file.data = buffer; @@ -202,7 +202,7 @@ static int gowin_set_instr(struct jtag_tap *tap, uint8_t new_instr) field.num_bits = tap->ir_length; void *t = calloc(DIV_ROUND_UP(field.num_bits, 8), 1); if (!t) { - LOG_ERROR("Out of memory"); + LOG_ERROR_OUT_OF_MEMORY(); return ERROR_FAIL; } field.out_value = t; @@ -579,7 +579,7 @@ PLD_CREATE_COMMAND_HANDLER(gowin_pld_create_command) struct gowin_pld_device *gowin_info = malloc(sizeof(struct gowin_pld_device)); if (!gowin_info) { - LOG_ERROR("Out of memory"); + LOG_ERROR_OUT_OF_MEMORY(); return ERROR_FAIL; } gowin_info->tap = tap; diff --git a/src/pld/intel.c b/src/pld/intel.c index a4bdabe26f..8eb2ed8756 100644 --- a/src/pld/intel.c +++ b/src/pld/intel.c @@ -78,7 +78,7 @@ static int intel_set_instr(struct jtag_tap *tap, uint16_t new_instr) field.num_bits = tap->ir_length; void *t = calloc(DIV_ROUND_UP(field.num_bits, 8), 1); if (!t) { - LOG_ERROR("Out of memory"); + LOG_ERROR_OUT_OF_MEMORY(); return ERROR_FAIL; } field.out_value = t; @@ -152,7 +152,7 @@ static int intel_load(struct pld_device *pld_device, const char *filename) if (intel_info->boundary_scan_length != 0) { uint8_t *buf = calloc(DIV_ROUND_UP(intel_info->boundary_scan_length, 8), 1); if (!buf) { - LOG_ERROR("Out of memory"); + LOG_ERROR_OUT_OF_MEMORY(); return ERROR_FAIL; } @@ -322,7 +322,7 @@ PLD_CREATE_COMMAND_HANDLER(intel_pld_create_command) struct intel_pld_device *intel_info = malloc(sizeof(struct intel_pld_device)); if (!intel_info) { - LOG_ERROR("Out of memory"); + LOG_ERROR_OUT_OF_MEMORY(); return ERROR_FAIL; } diff --git a/src/pld/lattice.c b/src/pld/lattice.c index 93ef3565c9..4472cae6c5 100644 --- a/src/pld/lattice.c +++ b/src/pld/lattice.c @@ -65,7 +65,7 @@ int lattice_set_instr(struct jtag_tap *tap, uint8_t new_instr, enum tap_state en field.num_bits = tap->ir_length; void *t = calloc(DIV_ROUND_UP(field.num_bits, 8), 1); if (!t) { - LOG_ERROR("Out of memory"); + LOG_ERROR_OUT_OF_MEMORY(); return ERROR_FAIL; } field.out_value = t; @@ -154,7 +154,7 @@ int lattice_preload(struct lattice_pld_device *lattice_device) return retval; uint8_t *buffer = malloc(sz_bytes); if (!buffer) { - LOG_ERROR("Out of memory"); + LOG_ERROR_OUT_OF_MEMORY(); return ERROR_FAIL; } memset(buffer, 0xff, sz_bytes); @@ -448,7 +448,7 @@ PLD_CREATE_COMMAND_HANDLER(lattice_pld_create_command) struct lattice_pld_device *lattice_device = malloc(sizeof(struct lattice_pld_device)); if (!lattice_device) { - LOG_ERROR("Out of memory"); + LOG_ERROR_OUT_OF_MEMORY(); return ERROR_FAIL; } diff --git a/src/pld/pld.c b/src/pld/pld.c index edd7796139..957b8df354 100644 --- a/src/pld/pld.c +++ b/src/pld/pld.c @@ -184,7 +184,7 @@ COMMAND_HANDLER(handle_pld_create_command) struct pld_device *pld_device = malloc(sizeof(struct pld_device)); if (!pld_device) { - LOG_ERROR("Out of memory"); + LOG_ERROR_OUT_OF_MEMORY(); return ERROR_FAIL; } @@ -200,7 +200,7 @@ COMMAND_HANDLER(handle_pld_create_command) } pld_device->name = strdup(CMD_ARGV[0]); if (!pld_device->name) { - LOG_ERROR("Out of memory"); + LOG_ERROR_OUT_OF_MEMORY(); free(pld_device); return ERROR_FAIL; } diff --git a/src/pld/raw_bit.c b/src/pld/raw_bit.c index 0c3b92e7e9..eb8bf454d9 100644 --- a/src/pld/raw_bit.c +++ b/src/pld/raw_bit.c @@ -39,7 +39,7 @@ int cpld_read_raw_bit_file(struct raw_bit_file *bit_file, const char *filename) bit_file->data = malloc(bit_file->length); if (!bit_file->data) { fclose(input_file); - LOG_ERROR("Out of memory"); + LOG_ERROR_OUT_OF_MEMORY(); return ERROR_PLD_FILE_LOAD_FAILED; } diff --git a/src/pld/virtex2.c b/src/pld/virtex2.c index 3dff90621a..20cac71b62 100644 --- a/src/pld/virtex2.c +++ b/src/pld/virtex2.c @@ -35,7 +35,7 @@ static int virtex2_set_instr(struct jtag_tap *tap, uint64_t new_instr) field.num_bits = tap->ir_length; void *t = calloc(DIV_ROUND_UP(field.num_bits, 8), 1); if (!t) { - LOG_ERROR("Out of memory"); + LOG_ERROR_OUT_OF_MEMORY(); return ERROR_FAIL; } field.out_value = t; @@ -60,7 +60,7 @@ static int virtex2_send_32(struct pld_device *pld_device, values = malloc(num_words * 4); if (!values) { - LOG_ERROR("Out of memory"); + LOG_ERROR_OUT_OF_MEMORY(); return ERROR_FAIL; } @@ -413,7 +413,7 @@ PLD_CREATE_COMMAND_HANDLER(virtex2_pld_create_command) struct virtex2_pld_device *virtex2_info = malloc(sizeof(struct virtex2_pld_device)); if (!virtex2_info) { - LOG_ERROR("Out of memory"); + LOG_ERROR_OUT_OF_MEMORY(); return ERROR_FAIL; } virtex2_info->tap = tap; diff --git a/src/rtos/linux.c b/src/rtos/linux.c index 5f59dc883a..b15b1c5c83 100644 --- a/src/rtos/linux.c +++ b/src/rtos/linux.c @@ -1041,7 +1041,7 @@ static int linux_gdb_thread_packet(struct target *target, char *out_str = calloc(MAX_THREADS * 17 + 10, 1); if (!out_str) { - LOG_ERROR("Out of memory"); + LOG_ERROR_OUT_OF_MEMORY(); return ERROR_FAIL; } char *tmp_str = out_str; @@ -1124,7 +1124,7 @@ static int linux_thread_extra_info(struct target *target, temp->status == 3 ? '*' : ' ', temp->pid, temp->name); if (!tmp_str) { - LOG_ERROR("Out of memory"); + LOG_ERROR_OUT_OF_MEMORY(); return ERROR_FAIL; } char *hex_str = calloc(1, strlen(tmp_str) * 2 + 1); diff --git a/src/rtos/rtos.c b/src/rtos/rtos.c index cc0e92edff..2dfafd870d 100644 --- a/src/rtos/rtos.c +++ b/src/rtos/rtos.c @@ -130,7 +130,7 @@ int rtos_create(struct command_invocation *cmd, struct target *target, all = alloc_printf("%s", rtos_types[x]->name); free(prev); if (!all) { - LOG_ERROR("Out of memory"); + LOG_ERROR_OUT_OF_MEMORY(); return ERROR_FAIL; } } @@ -387,7 +387,7 @@ int rtos_thread_packet(struct connection *connection, char const *packet, int pa char *tmp_str = calloc(str_size + 9, sizeof(char)); if (!tmp_str) { - LOG_ERROR("Out of memory"); + LOG_ERROR_OUT_OF_MEMORY(); return ERROR_FAIL; } char *tmp_str_ptr = tmp_str; @@ -512,7 +512,7 @@ static int rtos_put_gdb_reg(struct connection *connection, char *hex = malloc(num_bytes); if (!hex) { - LOG_ERROR("Out of memory"); + LOG_ERROR_OUT_OF_MEMORY(); return ERROR_FAIL; } diff --git a/src/rtos/zephyr.c b/src/rtos/zephyr.c index 023db60c9e..56fd569c58 100644 --- a/src/rtos/zephyr.c +++ b/src/rtos/zephyr.c @@ -477,7 +477,7 @@ static void *zephyr_array_append(struct zephyr_array *array, size_t size) void *ptr = realloc(array->ptr, (array->elements + 16) * size); if (!ptr) { - LOG_ERROR("Out of memory"); + LOG_ERROR_OUT_OF_MEMORY(); return NULL; } @@ -777,7 +777,7 @@ static int zephyr_get_symbol_list_to_lookup(struct symbol_table_elem **symbol_li { *symbol_list = malloc(sizeof(zephyr_symbol_list)); if (!*symbol_list) { - LOG_ERROR("Out of memory"); + LOG_ERROR_OUT_OF_MEMORY(); return ERROR_FAIL; } diff --git a/src/server/gdb_server.c b/src/server/gdb_server.c index b966e85938..ade175e5ab 100644 --- a/src/server/gdb_server.c +++ b/src/server/gdb_server.c @@ -3889,7 +3889,7 @@ static int gdb_target_start(struct target *target, const char *port) { struct gdb_service *gdb_service = malloc(sizeof(struct gdb_service)); if (!gdb_service) { - LOG_ERROR("Out of memory"); + LOG_ERROR_OUT_OF_MEMORY(); return ERROR_FAIL; } diff --git a/src/server/ipdbg.c b/src/server/ipdbg.c index 466717c468..8fbe8e4abd 100644 --- a/src/server/ipdbg.c +++ b/src/server/ipdbg.c @@ -187,7 +187,7 @@ static int ipdbg_create_service(struct ipdbg_hub *hub, uint8_t tool, struct ipdb { *service = calloc(1, sizeof(struct ipdbg_service)); if (!*service) { - LOG_ERROR("Out of memory"); + LOG_ERROR_OUT_OF_MEMORY(); return ERROR_FAIL; } @@ -286,7 +286,7 @@ static struct ipdbg_hub *ipdbg_allocate_hub(uint8_t data_register_length, struct struct ipdbg_hub *new_hub = calloc(1, sizeof(struct ipdbg_hub)); if (!new_hub) { free(virtual_ir); - LOG_ERROR("Out of memory"); + LOG_ERROR_OUT_OF_MEMORY(); return NULL; } @@ -294,7 +294,7 @@ static struct ipdbg_hub *ipdbg_allocate_hub(uint8_t data_register_length, struct if (!new_hub->name) { free(new_hub); free(virtual_ir); - LOG_ERROR("Out of memory"); + LOG_ERROR_OUT_OF_MEMORY(); return NULL; } @@ -315,7 +315,7 @@ static struct ipdbg_hub *ipdbg_allocate_hub(uint8_t data_register_length, struct !new_hub->scratch_memory.fields || (virtual_ir && !new_hub->scratch_memory.vir_out_val) || !new_hub->connections) { ipdbg_free_hub(new_hub); - LOG_ERROR("Out of memory"); + LOG_ERROR_OUT_OF_MEMORY(); return NULL; } @@ -347,7 +347,7 @@ static int ipdbg_shift_instr(struct ipdbg_hub *hub, uint32_t instr) uint8_t *ir_out_val = calloc(DIV_ROUND_UP(tap->ir_length, 8), 1); if (!ir_out_val) { - LOG_ERROR("Out of memory"); + LOG_ERROR_OUT_OF_MEMORY(); return ERROR_FAIL; } buf_set_u32(ir_out_val, 0, tap->ir_length, instr); @@ -1100,7 +1100,7 @@ COMMAND_HANDLER(handle_ipdbg_create_hub_command) if (has_virtual_ir) { virtual_ir = calloc(1, sizeof(struct ipdbg_virtual_ir_info)); if (!virtual_ir) { - LOG_ERROR("Out of memory"); + LOG_ERROR_OUT_OF_MEMORY(); return ERROR_FAIL; } virtual_ir->instruction = virtual_ir_instruction; diff --git a/src/server/rtt_server.c b/src/server/rtt_server.c index b44101c3dc..be7a54041b 100644 --- a/src/server/rtt_server.c +++ b/src/server/rtt_server.c @@ -67,7 +67,7 @@ static int rtt_new_connection(struct connection *connection) data = calloc(1, sizeof(struct rtt_connection_data)); if (!data) { - LOG_ERROR("Out of memory"); + LOG_ERROR_OUT_OF_MEMORY(); return ERROR_FAIL; } @@ -164,7 +164,7 @@ COMMAND_HANDLER(handle_rtt_start_command) service = calloc(1, sizeof(struct rtt_service)); if (!service) { - LOG_ERROR("Out of memory"); + LOG_ERROR_OUT_OF_MEMORY(); return ERROR_FAIL; } @@ -176,7 +176,7 @@ COMMAND_HANDLER(handle_rtt_start_command) service->hello_message = malloc(hello_length + 2); if (!service->hello_message) { - LOG_ERROR("Out of memory"); + LOG_ERROR_OUT_OF_MEMORY(); free(service); return ERROR_FAIL; } diff --git a/src/server/server.c b/src/server/server.c index 0b957836d3..17ad5e3604 100644 --- a/src/server/server.c +++ b/src/server/server.c @@ -212,7 +212,7 @@ int add_service(const struct service_driver *driver, const char *port, c = calloc(1, sizeof(*c)); if (!c) { - LOG_ERROR("Out of memory"); + LOG_ERROR_OUT_OF_MEMORY(); return ERROR_FAIL; } @@ -231,7 +231,7 @@ int add_service(const struct service_driver *driver, const char *port, c->next = NULL; if (!c->name || !c->port) { - LOG_ERROR("Out of memory"); + LOG_ERROR_OUT_OF_MEMORY(); goto error; } diff --git a/src/server/telnet_server.c b/src/server/telnet_server.c index 3634a2a592..0516f872ce 100644 --- a/src/server/telnet_server.c +++ b/src/server/telnet_server.c @@ -637,7 +637,7 @@ static void telnet_auto_complete(struct connection *connection) query_cmd = alloc_printf("_telnet_autocomplete_helper {%s*}", query); if (!query_cmd) { - LOG_ERROR("Out of memory"); + LOG_ERROR_OUT_OF_MEMORY(); return; } @@ -685,7 +685,7 @@ static void telnet_auto_complete(struct connection *connection) if (!ignore_cmd) { struct cmd_match *match = calloc(1, sizeof(struct cmd_match)); if (!match) { - LOG_ERROR("Out of memory"); + LOG_ERROR_OUT_OF_MEMORY(); Jim_DecrRefCount(command_context->interp, elem); break; /* break the for loop */ } diff --git a/src/target/aarch64.c b/src/target/aarch64.c index 032a0da9a0..e617071108 100644 --- a/src/target/aarch64.c +++ b/src/target/aarch64.c @@ -2857,7 +2857,7 @@ static int armv8r_target_create(struct target *target) aarch64 = calloc(1, sizeof(struct aarch64_common)); if (!aarch64) { - LOG_ERROR("Out of memory"); + LOG_ERROR_OUT_OF_MEMORY(); return ERROR_FAIL; } @@ -2876,7 +2876,7 @@ static int aarch64_target_create(struct target *target) aarch64 = calloc(1, sizeof(struct aarch64_common)); if (!aarch64) { - LOG_ERROR("Out of memory"); + LOG_ERROR_OUT_OF_MEMORY(); return ERROR_FAIL; } diff --git a/src/target/arc_cmd.c b/src/target/arc_cmd.c index 2e42398d28..5e93645875 100644 --- a/src/target/arc_cmd.c +++ b/src/target/arc_cmd.c @@ -156,7 +156,7 @@ COMMAND_HANDLER(arc_handle_add_reg_type_flags) struct reg_data_type_flags_field *fields = calloc(fields_sz, sizeof(*fields)); struct arc_reg_bitfield *bitfields = calloc(fields_sz, sizeof(*bitfields)); if (!type || !fields || !bitfields) { - LOG_ERROR("Out of memory"); + LOG_ERROR_OUT_OF_MEMORY(); retval = ERROR_FAIL; goto fail; } @@ -469,7 +469,7 @@ COMMAND_HANDLER(arc_handle_add_reg_type_struct) struct reg_data_type_struct_field *fields = calloc(fields_sz, sizeof(*fields)); struct arc_reg_bitfield *bitfields = calloc(fields_sz, sizeof(*bitfields)); if (!type || !fields || !bitfields) { - LOG_ERROR("Out of memory"); + LOG_ERROR_OUT_OF_MEMORY(); retval = ERROR_FAIL; goto fail; } @@ -556,7 +556,7 @@ static COMMAND_HELPER(arc_handle_add_reg_do, struct arc_reg_desc *reg) reg->name = strdup(CMD_ARGV[0]); if (!reg->name) { - LOG_ERROR("Out of memory"); + LOG_ERROR_OUT_OF_MEMORY(); return ERROR_FAIL; } @@ -589,7 +589,7 @@ static COMMAND_HELPER(arc_handle_add_reg_do, struct arc_reg_desc *reg) reg->gdb_xml_feature = strdup(CMD_ARGV[0]); if (!reg->gdb_xml_feature) { - LOG_ERROR("Out of memory"); + LOG_ERROR_OUT_OF_MEMORY(); return ERROR_FAIL; } @@ -647,7 +647,7 @@ COMMAND_HANDLER(arc_handle_add_reg) { struct arc_reg_desc *reg = calloc(1, sizeof(*reg)); if (!reg) { - LOG_ERROR("Out of memory"); + LOG_ERROR_OUT_OF_MEMORY(); return ERROR_FAIL; } diff --git a/src/target/arm_adi_v5.c b/src/target/arm_adi_v5.c index 67a3fcc577..47d46baf36 100644 --- a/src/target/arm_adi_v5.c +++ b/src/target/arm_adi_v5.c @@ -2456,7 +2456,7 @@ int adiv5_jim_configure_ext(struct target *target, struct jim_getopt_info *goi, if (!pc) { pc = calloc(1, sizeof(struct adiv5_private_config)); if (!pc) { - LOG_ERROR("Out of memory"); + LOG_ERROR_OUT_OF_MEMORY(); return JIM_ERR; } pc->ap_num = DP_APSEL_INVALID; diff --git a/src/target/arm_cti.c b/src/target/arm_cti.c index 032e5ac379..fb8b23fb1e 100644 --- a/src/target/arm_cti.c +++ b/src/target/arm_cti.c @@ -449,7 +449,7 @@ COMMAND_HANDLER(handle_cti_create) /* Create it */ struct arm_cti *cti = calloc(1, sizeof(*cti)); if (!cti) { - LOG_ERROR("Out of memory"); + LOG_ERROR_OUT_OF_MEMORY(); return ERROR_FAIL; } @@ -471,7 +471,7 @@ COMMAND_HANDLER(handle_cti_create) cti->name = strdup(CMD_ARGV[0]); if (!cti->name) { - LOG_ERROR("Out of memory"); + LOG_ERROR_OUT_OF_MEMORY(); free(cti); return ERROR_FAIL; } diff --git a/src/target/arm_dap.c b/src/target/arm_dap.c index 532f192b7d..3b7445dc02 100644 --- a/src/target/arm_dap.c +++ b/src/target/arm_dap.c @@ -350,7 +350,7 @@ COMMAND_HANDLER(handle_dap_create) /* Create it */ struct arm_dap_object *dap = calloc(1, sizeof(struct arm_dap_object)); if (!dap) { - LOG_ERROR("Out of memory"); + LOG_ERROR_OUT_OF_MEMORY(); return ERROR_FAIL; } @@ -358,7 +358,7 @@ COMMAND_HANDLER(handle_dap_create) dap->name = strdup(CMD_ARGV[0]); if (!dap->name) { - LOG_ERROR("Out of memory"); + LOG_ERROR_OUT_OF_MEMORY(); free(dap); return ERROR_FAIL; } diff --git a/src/target/arm_tpiu_swo.c b/src/target/arm_tpiu_swo.c index 715b1c962c..10f8fcfd31 100644 --- a/src/target/arm_tpiu_swo.c +++ b/src/target/arm_tpiu_swo.c @@ -252,7 +252,7 @@ static int arm_tpiu_swo_service_new_connection(struct connection *connection) struct arm_tpiu_swo_object *obj = priv->obj; struct arm_tpiu_swo_connection *c = malloc(sizeof(*c)); if (!c) { - LOG_ERROR("Out of memory"); + LOG_ERROR_OUT_OF_MEMORY(); return ERROR_FAIL; } c->connection = connection; @@ -478,7 +478,7 @@ static int arm_tpiu_swo_configure(struct jim_getopt_info *goi, struct arm_tpiu_s } char *out_filename = strdup(s); if (!out_filename) { - LOG_ERROR("Out of memory"); + LOG_ERROR_OUT_OF_MEMORY(); return JIM_ERR; } free(obj->out_filename); @@ -525,7 +525,7 @@ static int arm_tpiu_swo_configure(struct jim_getopt_info *goi, struct arm_tpiu_s if (!ea) { ea = calloc(1, sizeof(*ea)); if (!ea) { - LOG_ERROR("Out of memory"); + LOG_ERROR_OUT_OF_MEMORY(); return JIM_ERR; } ea->next = obj->event_action; @@ -730,7 +730,7 @@ COMMAND_HANDLER(handle_arm_tpiu_swo_enable) if (obj->out_filename[0] == ':') { struct arm_tpiu_swo_priv_connection *priv = malloc(sizeof(*priv)); if (!priv) { - LOG_ERROR("Out of memory"); + LOG_ERROR_OUT_OF_MEMORY(); return ERROR_FAIL; } priv->obj = obj; @@ -933,7 +933,7 @@ COMMAND_HANDLER(handle_arm_tpiu_swo_create) struct arm_tpiu_swo_object *obj = calloc(1, sizeof(struct arm_tpiu_swo_object)); if (!obj) { - LOG_ERROR("Out of memory"); + LOG_ERROR_OUT_OF_MEMORY(); return ERROR_FAIL; } INIT_LIST_HEAD(&obj->connections); @@ -942,13 +942,13 @@ COMMAND_HANDLER(handle_arm_tpiu_swo_create) obj->port_width = 1; obj->out_filename = strdup("external"); if (!obj->out_filename) { - LOG_ERROR("Out of memory"); + LOG_ERROR_OUT_OF_MEMORY(); goto err_exit; } obj->name = strdup(CMD_ARGV[0]); if (!obj->name) { - LOG_ERROR("Out of memory"); + LOG_ERROR_OUT_OF_MEMORY(); goto err_exit; } diff --git a/src/target/cortex_a.c b/src/target/cortex_a.c index 2efbcce0c9..ab3ca662e1 100644 --- a/src/target/cortex_a.c +++ b/src/target/cortex_a.c @@ -3223,7 +3223,7 @@ static int cortex_a_target_create(struct target *target) cortex_a = calloc(1, sizeof(struct cortex_a_common)); if (!cortex_a) { - LOG_ERROR("Out of memory"); + LOG_ERROR_OUT_OF_MEMORY(); return ERROR_FAIL; } cortex_a->common_magic = CORTEX_A_COMMON_MAGIC; @@ -3244,7 +3244,7 @@ static int cortex_r4_target_create(struct target *target) cortex_a = calloc(1, sizeof(struct cortex_a_common)); if (!cortex_a) { - LOG_ERROR("Out of memory"); + LOG_ERROR_OUT_OF_MEMORY(); return ERROR_FAIL; } cortex_a->common_magic = CORTEX_A_COMMON_MAGIC; diff --git a/src/target/image.c b/src/target/image.c index 9b7031b290..68fdf5e45d 100644 --- a/src/target/image.c +++ b/src/target/image.c @@ -335,13 +335,13 @@ static int image_ihex_buffer_complete(struct image *image) { char *lpsz_line = malloc(1023); if (!lpsz_line) { - LOG_ERROR("Out of memory"); + LOG_ERROR_OUT_OF_MEMORY(); return ERROR_FAIL; } struct imagesection *section = malloc(sizeof(struct imagesection) * IMAGE_MAX_SECTIONS); if (!section) { free(lpsz_line); - LOG_ERROR("Out of memory"); + LOG_ERROR_OUT_OF_MEMORY(); return ERROR_FAIL; } int retval; @@ -934,13 +934,13 @@ static int image_mot_buffer_complete(struct image *image) { char *lpsz_line = malloc(1023); if (!lpsz_line) { - LOG_ERROR("Out of memory"); + LOG_ERROR_OUT_OF_MEMORY(); return ERROR_FAIL; } struct imagesection *section = malloc(sizeof(struct imagesection) * IMAGE_MAX_SECTIONS); if (!section) { free(lpsz_line); - LOG_ERROR("Out of memory"); + LOG_ERROR_OUT_OF_MEMORY(); return ERROR_FAIL; } int retval; diff --git a/src/target/mips32_pracc.c b/src/target/mips32_pracc.c index 9a22a5031e..a7a416b199 100644 --- a/src/target/mips32_pracc.c +++ b/src/target/mips32_pracc.c @@ -345,7 +345,7 @@ int mips32_pracc_queue_exec(struct mips_ejtag *ejtag_info, struct pracc_queue_in uint32_t *buf, bool check_last) { if (ctx->retval != ERROR_OK) { - LOG_ERROR("Out of memory"); + LOG_ERROR_OUT_OF_MEMORY(); return ERROR_FAIL; } @@ -366,7 +366,7 @@ int mips32_pracc_queue_exec(struct mips_ejtag *ejtag_info, struct pracc_queue_in } *scan_in = malloc(sizeof(union scan_in) * (ctx->code_count + ctx->store_count)); if (!scan_in) { - LOG_ERROR("Out of memory"); + LOG_ERROR_OUT_OF_MEMORY(); return ERROR_FAIL; } @@ -478,7 +478,7 @@ int mips32_pracc_read_mem(struct mips_ejtag *ejtag_info, uint32_t addr, int size if (size != 4) { data = malloc(256 * sizeof(uint32_t)); if (!data) { - LOG_ERROR("Out of memory"); + LOG_ERROR_OUT_OF_MEMORY(); goto exit; } } diff --git a/src/target/mips_m4k.c b/src/target/mips_m4k.c index 49658b7353..f4c09e88ac 100644 --- a/src/target/mips_m4k.c +++ b/src/target/mips_m4k.c @@ -1039,7 +1039,7 @@ static int mips_m4k_read_memory(struct target *target, target_addr_t address, if (size > 1) { t = malloc(count * size * sizeof(uint8_t)); if (!t) { - LOG_ERROR("Out of memory"); + LOG_ERROR_OUT_OF_MEMORY(); return ERROR_FAIL; } } else @@ -1106,7 +1106,7 @@ static int mips_m4k_write_memory(struct target *target, target_addr_t address, /* endianness, but byte array represents target endianness */ t = malloc(count * size * sizeof(uint8_t)); if (!t) { - LOG_ERROR("Out of memory"); + LOG_ERROR_OUT_OF_MEMORY(); return ERROR_FAIL; } @@ -1244,7 +1244,7 @@ static int mips_m4k_bulk_write_memory(struct target *target, target_addr_t addre uint32_t *t = NULL; t = malloc(count * sizeof(uint32_t)); if (!t) { - LOG_ERROR("Out of memory"); + LOG_ERROR_OUT_OF_MEMORY(); return ERROR_FAIL; } @@ -1309,7 +1309,7 @@ static int mips_m4k_bulk_read_memory(struct target *target, target_addr_t addres /* but byte array represents target endianness */ uint32_t *t = malloc(count * sizeof(uint32_t)); if (!t) { - LOG_ERROR("Out of memory"); + LOG_ERROR_OUT_OF_MEMORY(); return ERROR_FAIL; } diff --git a/src/target/mips_mips64.c b/src/target/mips_mips64.c index eb94399e66..4df3df81b4 100644 --- a/src/target/mips_mips64.c +++ b/src/target/mips_mips64.c @@ -905,7 +905,7 @@ static int mips_mips64_read_memory(struct target *target, uint64_t address, if (size > 1) { t = calloc(count, size); if (!t) { - LOG_ERROR("Out of memory"); + LOG_ERROR_OUT_OF_MEMORY(); return ERROR_FAIL; } } else @@ -989,7 +989,7 @@ static int mips_mips64_bulk_write_memory(struct target *target, t = calloc(count, sizeof(uint64_t)); if (!t) { - LOG_ERROR("Out of memory"); + LOG_ERROR_OUT_OF_MEMORY(); return ERROR_FAIL; } diff --git a/src/target/openrisc/jsp_server.c b/src/target/openrisc/jsp_server.c index 60cbb49834..fa0760ac7d 100644 --- a/src/target/openrisc/jsp_server.c +++ b/src/target/openrisc/jsp_server.c @@ -196,7 +196,7 @@ int jsp_init(struct or1k_jtag *jtag_info, char *banner) { struct jsp_service *jsp_service = malloc(sizeof(struct jsp_service)); if (!jsp_service) { - LOG_ERROR("Out of memory"); + LOG_ERROR_OUT_OF_MEMORY(); return ERROR_FAIL; } diff --git a/src/target/openrisc/or1k_du_adv.c b/src/target/openrisc/or1k_du_adv.c index f401ea9fb5..fc7068820d 100644 --- a/src/target/openrisc/or1k_du_adv.c +++ b/src/target/openrisc/or1k_du_adv.c @@ -914,7 +914,7 @@ static int or1k_adv_jtag_write_memory(struct or1k_jtag *jtag_info, if ((target->endianness == TARGET_BIG_ENDIAN) && (size != 1)) { t = calloc(count * size, sizeof(uint8_t)); if (!t) { - LOG_ERROR("Out of memory"); + LOG_ERROR_OUT_OF_MEMORY(); return ERROR_FAIL; } diff --git a/src/target/riscv/riscv.c b/src/target/riscv/riscv.c index 8054a1c9b7..6aa0fb297c 100644 --- a/src/target/riscv/riscv.c +++ b/src/target/riscv/riscv.c @@ -4211,7 +4211,7 @@ static int riscv_openocd_step_impl(struct target *target, bool current, RISCV_INFO(r); bool *wps_to_enable = calloc(r->trigger_count, sizeof(*wps_to_enable)); if (!wps_to_enable) { - LOG_ERROR("Out of memory"); + LOG_ERROR_OUT_OF_MEMORY(); return ERROR_FAIL; } @@ -4458,7 +4458,7 @@ static int parse_reg_ranges_impl(struct list_head *ranges, char *args, *name_buffer = calloc(1, strlen(reg_name_in) + reg_type_len + 2); name = *name_buffer; if (!name) { - LOG_ERROR("Out of memory"); + LOG_ERROR_OUT_OF_MEMORY(); return ERROR_FAIL; } strcpy(name, reg_type); @@ -4504,7 +4504,7 @@ static int parse_reg_ranges_impl(struct list_head *ranges, char *args, range_list_t *range = calloc(1, sizeof(range_list_t)); if (!range) { - LOG_ERROR("Out of memory"); + LOG_ERROR_OUT_OF_MEMORY(); return ERROR_FAIL; } @@ -4524,7 +4524,7 @@ static int parse_reg_ranges(struct list_head *ranges, const char *tcl_arg, { char *args = strdup(tcl_arg); if (!args) { - LOG_ERROR("Out of memory"); + LOG_ERROR_OUT_OF_MEMORY(); return ERROR_FAIL; } char *name_buffer = NULL; diff --git a/src/target/semihosting_common.c b/src/target/semihosting_common.c index 345e542c3c..5c29faaa05 100644 --- a/src/target/semihosting_common.c +++ b/src/target/semihosting_common.c @@ -1937,7 +1937,7 @@ COMMAND_HANDLER(handle_common_semihosting_redirect_command) service->name = alloc_printf("%s semihosting service", target_name(target)); if (!service->name) { - LOG_ERROR("Out of memory"); + LOG_ERROR_OUT_OF_MEMORY(); free(service); return ERROR_FAIL; } diff --git a/src/target/target.c b/src/target/target.c index f766d1da43..a1504dd6d3 100644 --- a/src/target/target.c +++ b/src/target/target.c @@ -3433,7 +3433,7 @@ static int target_fill_mem(struct target *target, const unsigned int chunk_size = 16384; uint8_t *target_buf = malloc(chunk_size * data_size); if (!target_buf) { - LOG_ERROR("Out of memory"); + LOG_ERROR_OUT_OF_MEMORY(); return ERROR_FAIL; } @@ -5173,7 +5173,7 @@ static COMMAND_HELPER(target_configure, struct target *target, unsigned int inde char *s = strdup(CMD_ARGV[index]); if (!s) { - LOG_ERROR("Out of memory"); + LOG_ERROR_OUT_OF_MEMORY(); return ERROR_FAIL; } free(target->gdb_port_override); @@ -5703,7 +5703,7 @@ COMMAND_HANDLER(handle_target_create) all = alloc_printf("%s", target_types[x]->name); free(prev); if (!all) { - LOG_ERROR("Out of memory"); + LOG_ERROR_OUT_OF_MEMORY(); return ERROR_FAIL; } } @@ -5715,7 +5715,7 @@ COMMAND_HANDLER(handle_target_create) /* Create it */ struct target *target = calloc(1, sizeof(struct target)); if (!target) { - LOG_ERROR("Out of memory"); + LOG_ERROR_OUT_OF_MEMORY(); return ERROR_FAIL; } @@ -5725,7 +5725,7 @@ COMMAND_HANDLER(handle_target_create) /* allocate memory for each unique target type */ target->type = malloc(sizeof(struct target_type)); if (!target->type) { - LOG_ERROR("Out of memory"); + LOG_ERROR_OUT_OF_MEMORY(); free(target); return ERROR_FAIL; } @@ -5757,7 +5757,7 @@ COMMAND_HANDLER(handle_target_create) /* initialize trace information */ target->trace_info = calloc(1, sizeof(struct trace)); if (!target->trace_info) { - LOG_ERROR("Out of memory"); + LOG_ERROR_OUT_OF_MEMORY(); free(target->type); free(target); return ERROR_FAIL; @@ -5776,7 +5776,7 @@ COMMAND_HANDLER(handle_target_create) target->cmd_name = strdup(CMD_ARGV[0]); if (!target->cmd_name) { - LOG_ERROR("Out of memory"); + LOG_ERROR_OUT_OF_MEMORY(); free(target->trace_info); free(target->type); free(target); @@ -5928,7 +5928,7 @@ create_target_list_node(const char *targetname) struct target_list *new = malloc(sizeof(struct target_list)); if (!new) { - LOG_ERROR("Out of memory"); + LOG_ERROR_OUT_OF_MEMORY(); return new; } @@ -5971,7 +5971,7 @@ COMMAND_HANDLER(handle_target_smp) struct list_head *lh = malloc(sizeof(*lh)); if (!lh) { - LOG_ERROR("Out of memory"); + LOG_ERROR_OUT_OF_MEMORY(); return ERROR_FAIL; } INIT_LIST_HEAD(lh); --
