From 4dc7aa24f2ab1fda4888a31e7a942a132ddee0fe Mon Sep 17 00:00:00 2001 From: Rutger Hofman Date: Tue, 5 May 2009 17:33:23 +0000 Subject: [PATCH] Start refactoring on jim/. We will need to move src/jim/tap.c to src/jim/jim_tap.c, but first commit the current changes. Does not run\! git-svn-id: https://urjtag.svn.sourceforge.net/svnroot/urjtag/trunk@1568 b68d4a1b-bc3d-0410-92ed-d4ac073336b7 --- urjtag/configure.ac | 2 +- urjtag/include/urjtag/Makefile.am | 1 - urjtag/include/urjtag/jim.h | 5 +- urjtag/include/urjtag/jim/some_cpu.h | 33 --------- urjtag/src/jim/intel_28f800b3.c | 73 +++++++++--------- urjtag/src/jim/some_cpu.c | 62 ++++++++-------- urjtag/src/jim/tap.c | 107 +++++++++++++-------------- 7 files changed, 123 insertions(+), 160 deletions(-) delete mode 100644 urjtag/include/urjtag/jim/some_cpu.h diff --git a/urjtag/configure.ac b/urjtag/configure.ac index 10b46922..0f58723d 100644 --- a/urjtag/configure.ac +++ b/urjtag/configure.ac @@ -267,7 +267,7 @@ AS_IF([test "x$with_inpout32" = xyes], [ ]) -CFLAGS="$CFLAGS -Wall -Wmissing-prototypes -Wstrict-prototypes" +CFLAGS="$CFLAGS -Wall -Wmissing-prototypes -Wstrict-prototypes -Wpointer-arith" CPPFLAGS="-I\$(top_srcdir) -I\$(top_srcdir)/include $CPPFLAGS" diff --git a/urjtag/include/urjtag/Makefile.am b/urjtag/include/urjtag/Makefile.am index 4ba72c09..5ce2169e 100644 --- a/urjtag/include/urjtag/Makefile.am +++ b/urjtag/include/urjtag/Makefile.am @@ -40,7 +40,6 @@ pkginclude_HEADERS = \ flash.h \ gettext.h \ jim.h \ - jim/some_cpu.h \ jtag.h \ part_instruction.h \ parport.h \ diff --git a/urjtag/include/urjtag/jim.h b/urjtag/include/urjtag/jim.h index 111240ff..b33479ef 100644 --- a/urjtag/include/urjtag/jim.h +++ b/urjtag/include/urjtag/jim.h @@ -100,7 +100,7 @@ struct urj_jim_bus_device int width; /* bytes */ int size; /* words (each bytes) */ void *state; /* device-dependent */ - void (*init) (urj_jim_bus_device_t *x); + int (*init) (urj_jim_bus_device_t *x); uint32_t (*capture) (urj_jim_bus_device_t *x, uint32_t address, uint32_t control, uint8_t *shmem, size_t shmem_size); @@ -127,7 +127,6 @@ void urj_jim_tck_fall (urj_jim_state_t *s); urj_jim_device_t *urj_jim_alloc_device (int num_sregs, const int reg_size[]); urj_jim_state_t *urj_jim_init (void); void urj_jim_free (urj_jim_state_t *s); -void urj_jim_print_sreg (urj_jim_shift_reg_t *r); -void urj_jim_print_tap_state (char *rof, urj_jim_device_t *dev); +urj_jim_device_t *urj_jim_some_cpu (void); #endif diff --git a/urjtag/include/urjtag/jim/some_cpu.h b/urjtag/include/urjtag/jim/some_cpu.h deleted file mode 100644 index 3f0f545b..00000000 --- a/urjtag/include/urjtag/jim/some_cpu.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * $Id: tap.c $ - * - * Copyright (C) 2008 Kolja Waschk - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#ifndef URJ_JIM_SOME_CPU_H -#define URJ_JIM_SOME_CPU_H - -#include - -void urj_jim_some_cpu_tck_rise (urj_jim_device_t *dev); -urj_jim_device_t *urj_jim_some_cpu (void); - -#endif /* ndef URJ_JIM_SOME_CPU_H */ diff --git a/urjtag/src/jim/intel_28f800b3.c b/urjtag/src/jim/intel_28f800b3.c index e43af2be..c2d363a7 100644 --- a/urjtag/src/jim/intel_28f800b3.c +++ b/urjtag/src/jim/intel_28f800b3.c @@ -32,10 +32,11 @@ #include #include +#include +#include +#include #include -#undef VERBOSE - typedef enum { READ_ARRAY = 0, @@ -106,37 +107,43 @@ typedef struct } intel_f28xxxb3_state_t; -void +static int urj_jim_intel_28fxxxb3_init (urj_jim_bus_device_t *d, uint16_t id, b3_boot_type_t bt) { d->state = malloc (sizeof (intel_f28xxxb3_state_t)); - if (d->state != NULL) + if (d->state == NULL) { - intel_f28xxxb3_state_t *is = d->state; - is->opstate = READ_ARRAY; - is->identifier = id; - is->boot_type = bt; - is->status = 0x00; - is->status_buffer = 0x00; - is->control_buffer = 0x00000000; + urj_error_set (URJ_ERROR_OUT_OF_MEMORY, "malloc(%zd) fails", + sizeof (intel_f28xxxb3_state_t)); + return URJ_STATUS_FAIL; } + + intel_f28xxxb3_state_t *is = d->state; + is->opstate = READ_ARRAY; + is->identifier = id; + is->boot_type = bt; + is->status = 0x00; + is->status_buffer = 0x00; + is->control_buffer = 0x00000000; + + return URJ_STATUS_OK; } -void +static int urj_jim_intel_28f800b3b_init (urj_jim_bus_device_t *d) { - urj_jim_intel_28fxxxb3_init (d, 0x8893, BOTTOM); + return urj_jim_intel_28fxxxb3_init (d, 0x8893, BOTTOM); } -void +static void urj_jim_intel_28fxxxb3_free (urj_jim_bus_device_t *d) { if (d->state != NULL) free (d->state); } -uint32_t +static uint32_t urj_jim_intel_28fxxxb3_capture (urj_jim_bus_device_t *d, uint32_t address, uint32_t control, uint8_t *shmem, size_t shmem_size) @@ -176,33 +183,28 @@ urj_jim_intel_28fxxxb3_capture (urj_jim_bus_device_t *d, default: break; } -#ifdef VERBOSE - printf ("i28fxxxb3: read %04X from %08X (in %s)\n", - data & 0xFFFF, address, - intel_28fxxx_opstate_name[is->opstate]); -#endif + urj_log (URJ_LOG_LEVEL_DETAIL, + "i28fxxxb3: read %04X from %08X (in %s)\n", + data & 0xFFFF, address, + intel_28fxxx_opstate_name[is->opstate]); } -#if 0 - printf ("capture A=%08X, D=%08X%s%s%s\n", address, data, - (control & 1) ? ", OE" : "", - (control & 2) ? ", WE" : "", (control & 4) ? ", CS" : ""); -#endif + urj_log (URJ_LOG_LEVEL_COMM, "capture A=%08X, D=%08X%s%s%s\n", + address, data, (control & 1) ? ", OE" : "", + (control & 2) ? ", WE" : "", (control & 4) ? ", CS" : ""); return data; } -void +static void urj_jim_intel_28fxxxb3_update (urj_jim_bus_device_t *d, uint32_t address, uint32_t data, uint32_t control, uint8_t *shmem, size_t shmem_size) { -#if 0 - printf ("update A=%08X, D=%08X%s%s%s\n", address, data, - (control & 1) ? ", OE" : "", - (control & 2) ? ", WE" : "", (control & 4) ? ", CS" : ""); -#endif + urj_log (URJ_LOG_LEVEL_COMM, "update A=%08X, D=%08X%s%s%s\n", + address, data, (control & 1) ? ", OE" : "", + (control & 2) ? ", WE" : "", (control & 4) ? ", CS" : ""); if (d->state != NULL) { @@ -254,11 +256,10 @@ urj_jim_intel_28fxxxb3_update (urj_jim_bus_device_t *d, intel_f28xxxb3_state_t *is = d->state; uint8_t dl = data & 0xFF; -#ifdef VERBOSE - printf ("i28fxxxb3: write %04X to %08X (in %s)\n", - data & 0xFFFF, address, - intel_28fxxx_opstate_name[is->opstate]); -#endif + urj_log (URJ_LOG_LEVEL_DETAIL, + "i28fxxxb3: write %04X to %08X (in %s)\n", + data & 0xFFFF, address, + intel_28fxxx_opstate_name[is->opstate]); if (dl == 0x50) { diff --git a/urjtag/src/jim/some_cpu.c b/urjtag/src/jim/some_cpu.c index 9db52edc..10765942 100644 --- a/urjtag/src/jim/some_cpu.c +++ b/urjtag/src/jim/some_cpu.c @@ -26,11 +26,12 @@ #include #include +#include +#include +#include #include #include -#undef VERBOSE - extern urj_jim_bus_device_t urj_jim_intel_28f800b3b; static urj_jim_attached_part_t some_cpu_attached[] = { @@ -46,7 +47,7 @@ static urj_jim_attached_part_t some_cpu_attached[] = { #define BSR_LEN 202 -void +static void urj_jim_some_cpu_report_idcode (urj_jim_device_t *dev) { dev->sreg[0].reg[0] = 0x1; /* IDCODE instruction b0001 */ @@ -54,10 +55,9 @@ urj_jim_some_cpu_report_idcode (urj_jim_device_t *dev) dev->current_dr = 1; /* IDR */ } -void -urj_jim_some_cpu_tck_rise (urj_jim_device_t *dev, - int tms, int tdi, uint8_t *shmem, - size_t shmem_size) +static void +urj_jim_some_cpu_tck_rise (urj_jim_device_t *dev, int tms, int tdi, + uint8_t *shmem, size_t shmem_size) { int i; @@ -76,9 +76,7 @@ urj_jim_some_cpu_tck_rise (urj_jim_device_t *dev, uint32_t d = 0; uint32_t c = dev->sreg[2].reg[3]; -#ifdef VERBOSE - printf ("URJ_JIM_CAPTURE_DR/EXTEST\n"); -#endif + urj_log (URJ_LOG_LEVEL_DETAIL, "URJ_JIM_CAPTURE_DR/EXTEST\n"); for (i = 0; some_cpu_attached[i].part; i++) { @@ -105,35 +103,25 @@ urj_jim_some_cpu_tck_rise (urj_jim_device_t *dev, case URJ_JIM_UPDATE_IR: -#ifdef VERBOSE - printf ("URJ_JIM_UPDATE_IR/"); -#endif + urj_log (URJ_LOG_LEVEL_DETAIL, "URJ_JIM_UPDATE_IR/"); switch (dev->sreg[0].reg[0]) { case 0x0: /* EXTEST */ -#ifdef VERBOSE - printf ("EXTEST\n"); -#endif + urj_log (URJ_LOG_LEVEL_DETAIL, "EXTEST\n"); dev->current_dr = 2; break; case 0x1: /* IDCODE */ -#ifdef VERBOSE - printf ("IDCODE\n"); -#endif + urj_log (URJ_LOG_LEVEL_DETAIL, "IDCODE\n"); urj_jim_some_cpu_report_idcode (dev); break; case 0x2: /* SAMPLE */ -#ifdef VERBOSE - printf ("SAMPLE\n"); -#endif + urj_log (URJ_LOG_LEVEL_DETAIL, "SAMPLE\n"); dev->current_dr = 2; break; case 0x3: /* BYPASS */ -#ifdef VERBOSE - printf ("BYPASS\n"); -#endif default: + urj_log (URJ_LOG_LEVEL_DETAIL, "BYPASS\n"); dev->current_dr = 0; /* BYPASS */ break; } @@ -144,7 +132,7 @@ urj_jim_some_cpu_tck_rise (urj_jim_device_t *dev, } } -void +static void urj_jim_some_cpu_tck_fall (urj_jim_device_t *dev, uint8_t *shmem, size_t shmem_size) { @@ -160,9 +148,7 @@ urj_jim_some_cpu_tck_fall (urj_jim_device_t *dev, uint8_t *shmem, uint32_t d = dev->sreg[2].reg[1]; uint32_t c = dev->sreg[2].reg[3]; -#ifdef VERBOSE - printf ("URJ_JIM_UPDATE_DR/EXTEST\n"); -#endif + urj_log (URJ_LOG_LEVEL_DETAIL, "URJ_JIM_UPDATE_DR/EXTEST\n"); for (i = 0; some_cpu_attached[i].part; i++) { @@ -189,7 +175,7 @@ urj_jim_some_cpu_tck_fall (urj_jim_device_t *dev, uint8_t *shmem, } } -void +static void urj_jim_some_cpu_free (urj_jim_device_t *dev) { int i; @@ -228,6 +214,8 @@ urj_jim_some_cpu (void) if (!dev->state) { free (dev); + urj_error_set (URJ_ERROR_OUT_OF_MEMORY, "malloc(%zd) fails", + sizeof (some_cpu_attached)); dev = NULL; } else @@ -245,13 +233,23 @@ urj_jim_some_cpu (void) &(((urj_jim_attached_part_t *) (dev->state))[i].part); *b = malloc (sizeof (urj_jim_bus_device_t)); if (*b == NULL) + { + urj_error_set (URJ_ERROR_OUT_OF_MEMORY, "malloc(%zd) fails", + sizeof (urj_jim_bus_device_t)); break; + } memcpy (*b, some_cpu_attached[i].part, sizeof (urj_jim_bus_device_t)); - (*b)->init (*b); + if ((*b)->init (*b) != URJ_STATUS_OK) + { + free (*b); + *b = NULL; + // retain error state + break; + } } - if (some_cpu_attached[i].part) /* loop broken; failed to malloc all parts */ + if (! some_cpu_attached[i].part) /* loop broken; failed to malloc all parts */ { for (i--; i >= 0; i--) free (((urj_jim_attached_part_t *) (dev->state))[i].part); diff --git a/urjtag/src/jim/tap.c b/urjtag/src/jim/tap.c index eb115fce..0f703f4c 100644 --- a/urjtag/src/jim/tap.c +++ b/urjtag/src/jim/tap.c @@ -27,89 +27,87 @@ #include #include +#include +#include #include -#include - -#undef VERBOSE - static const urj_jim_tap_state_t next_tap_state[16][2] = { - /* URJ_JIM_RESET */ {URJ_JIM_IDLE, URJ_JIM_RESET}, - /* URJ_JIM_SELECT_DR */ {URJ_JIM_CAPTURE_DR, URJ_JIM_SELECT_IR}, - /* URJ_JIM_CAPTURE_DR */ {URJ_JIM_SHIFT_DR, URJ_JIM_EXIT1_DR}, - /* URJ_JIM_SHIFT_DR */ {URJ_JIM_SHIFT_DR, URJ_JIM_EXIT1_DR}, - /* URJ_JIM_EXIT1_DR */ {URJ_JIM_PAUSE_DR, URJ_JIM_UPDATE_DR}, - /* URJ_JIM_PAUSE_DR */ {URJ_JIM_PAUSE_DR, URJ_JIM_EXIT2_DR}, - /* URJ_JIM_EXIT2_DR */ {URJ_JIM_SHIFT_DR, URJ_JIM_UPDATE_DR}, - /* URJ_JIM_UPDATE_DR */ {URJ_JIM_IDLE, URJ_JIM_SELECT_DR}, - /* URJ_JIM_IDLE */ {URJ_JIM_IDLE, URJ_JIM_SELECT_DR}, - /* URJ_JIM_SELECT_IR */ {URJ_JIM_CAPTURE_IR, URJ_JIM_RESET}, - /* URJ_JIM_CAPTURE_IR */ {URJ_JIM_SHIFT_IR, URJ_JIM_EXIT1_IR}, - /* URJ_JIM_SHIFT_IR */ {URJ_JIM_SHIFT_IR, URJ_JIM_EXIT1_IR}, - /* URJ_JIM_EXIT1_IR */ {URJ_JIM_PAUSE_IR, URJ_JIM_UPDATE_IR}, - /* URJ_JIM_PAUSE_IR */ {URJ_JIM_EXIT2_IR, URJ_JIM_EXIT2_IR}, - /* URJ_JIM_EXIT2_IR */ {URJ_JIM_SHIFT_IR, URJ_JIM_UPDATE_IR}, - /* URJ_JIM_UPDATE_IR */ {URJ_JIM_IDLE, URJ_JIM_SELECT_DR} + /* URJ_JIM_RESET */ {URJ_JIM_IDLE, URJ_JIM_RESET}, + /* URJ_JIM_SELECT_DR */ {URJ_JIM_CAPTURE_DR, URJ_JIM_SELECT_IR}, + /* URJ_JIM_CAPTURE_DR */ {URJ_JIM_SHIFT_DR, URJ_JIM_EXIT1_DR}, + /* URJ_JIM_SHIFT_DR */ {URJ_JIM_SHIFT_DR, URJ_JIM_EXIT1_DR}, + /* URJ_JIM_EXIT1_DR */ {URJ_JIM_PAUSE_DR, URJ_JIM_UPDATE_DR}, + /* URJ_JIM_PAUSE_DR */ {URJ_JIM_PAUSE_DR, URJ_JIM_EXIT2_DR}, + /* URJ_JIM_EXIT2_DR */ {URJ_JIM_SHIFT_DR, URJ_JIM_UPDATE_DR}, + /* URJ_JIM_UPDATE_DR */ {URJ_JIM_IDLE, URJ_JIM_SELECT_DR}, + /* URJ_JIM_IDLE */ {URJ_JIM_IDLE, URJ_JIM_SELECT_DR}, + /* URJ_JIM_SELECT_IR */ {URJ_JIM_CAPTURE_IR, URJ_JIM_RESET}, + /* URJ_JIM_CAPTURE_IR */ {URJ_JIM_SHIFT_IR, URJ_JIM_EXIT1_IR}, + /* URJ_JIM_SHIFT_IR */ {URJ_JIM_SHIFT_IR, URJ_JIM_EXIT1_IR}, + /* URJ_JIM_EXIT1_IR */ {URJ_JIM_PAUSE_IR, URJ_JIM_UPDATE_IR}, + /* URJ_JIM_PAUSE_IR */ {URJ_JIM_EXIT2_IR, URJ_JIM_EXIT2_IR}, + /* URJ_JIM_EXIT2_IR */ {URJ_JIM_SHIFT_IR, URJ_JIM_UPDATE_IR}, + /* URJ_JIM_UPDATE_IR */ {URJ_JIM_IDLE, URJ_JIM_SELECT_DR} }; -void -urj_jim_print_sreg (urj_jim_shift_reg_t *r) +static void +urj_jim_print_sreg (urj_log_level_t ll, urj_jim_shift_reg_t *r) { int i; for (i = (r->len + 31) / 32; i >= 0; i--) - printf (" %08X", r->reg[i]); + urj_log (ll, " %08X", r->reg[i]); } -void -urj_jim_print_tap_state (char *rof, urj_jim_device_t *dev) +static void +urj_jim_print_tap_state (urj_log_level_t ll, char *rof, urj_jim_device_t *dev) { - printf (" tck %s, state=", rof); + urj_log (ll, " tck %s, state=", rof); switch (dev->tap_state & 7) { case 0: - printf ((dev->tap_state == URJ_JIM_RESET) ? "URJ_JIM_RESET" - : "URJ_JIM_IDLE"); + urj_log (ll, (dev->tap_state == URJ_JIM_RESET) ? "URJ_JIM_RESET" + : "URJ_JIM_IDLE"); break; case 1: - printf ("SELECT"); + urj_log (ll, "SELECT"); break; case 2: - printf ("CAPTURE"); + urj_log (ll, "CAPTURE"); break; case 3: - printf ("SHIFT"); + urj_log (ll, "SHIFT"); break; case 4: - printf ("EXIT1"); + urj_log (ll, "EXIT1"); break; case 5: - printf ("PAUSE"); + urj_log (ll, "PAUSE"); break; case 6: - printf ("EXIT2"); + urj_log (ll, "EXIT2"); break; default: - printf ("UPDATE"); + urj_log (ll, "UPDATE"); break; } if (dev->tap_state & 7) { if (dev->tap_state & 8) { - printf ("_IR="); - urj_jim_print_sreg (&dev->sreg[0]); + urj_log (ll, "_IR="); + urj_jim_print_sreg (ll, &dev->sreg[0]); } else { - printf ("_DR"); + urj_log (ll, "_DR"); if (dev->current_dr != 0) { - printf ("(%d)=", dev->current_dr); - urj_jim_print_sreg (&dev->sreg[dev->current_dr]); + urj_log (ll, "(%d)=", dev->current_dr); + urj_jim_print_sreg (ll, &dev->sreg[dev->current_dr]); } } } - printf ("\n"); + urj_log (ll, "\n"); } @@ -145,9 +143,7 @@ urj_jim_tck_rise (urj_jim_state_t *s, int tms, int tdi) urj_jim_shift_reg_t *sr; uint32_t *reg; -#ifdef VERBOSE - urj_jim_print_tap_state ("rise", dev); -#endif + urj_jim_print_tap_state (URJ_LOG_LEVEL_DETAIL, "rise", dev); dev_tdi = (dev->prev != NULL) ? dev->prev->tdo : tdi; @@ -219,9 +215,7 @@ urj_jim_tck_fall (urj_jim_state_t *s) { dev->tdo = dev->tdo_buffer; -#ifdef VERBOSE - urj_jim_print_tap_state ("fall", dev); -#endif + urj_jim_print_tap_state (URJ_LOG_LEVEL_DETAIL, "fall", dev); if (dev->tck_fall != NULL) dev->tck_fall (dev, s->shmem, s->shmem_size); @@ -237,7 +231,8 @@ urj_jim_alloc_device (int num_sregs, const int reg_size[]) if (dev == NULL) { - printf ("Out of memory\n"); + urj_error_set (URJ_ERROR_OUT_OF_MEMORY, "malloc(%zd) fails", + sizeof (urj_jim_device_t)); return NULL; } @@ -245,7 +240,8 @@ urj_jim_alloc_device (int num_sregs, const int reg_size[]) if (dev->sreg == NULL) { free (dev); - printf ("Out of memory\n"); + urj_error_set (URJ_ERROR_OUT_OF_MEMORY, "malloc(%zd) fails", + sizeof (urj_jim_shift_reg_t)); return NULL; } @@ -260,7 +256,7 @@ urj_jim_alloc_device (int num_sregs, const int reg_size[]) if (r > 0) { - printf ("Out of memory\n"); + urj_error_set (URJ_ERROR_OUT_OF_MEMORY, "calloc() fails"); for (i = 0; i < num_sregs; i++) if (dev->sreg[i].reg != NULL) free (dev->sreg[i].reg); @@ -288,7 +284,8 @@ urj_jim_init (void) s = malloc (sizeof (urj_jim_state_t)); if (s == NULL) { - printf ("Out of memory!\n"); + urj_error_set (URJ_ERROR_OUT_OF_MEMORY, "malloc(%zd) fails", + sizeof (urj_jim_state_t)); return NULL; } @@ -298,13 +295,15 @@ urj_jim_init (void) if (s->shmem != NULL) { memset (s->shmem, 0xFF, s->shmem_size); - printf ("Allocated %zd bytes for device memory simulation.\n", + urj_log (URJ_LOG_LEVEL_NORMAL, + "Allocated %zd bytes for device memory simulation.\n", s->shmem_size); } else { free (s); - printf ("Out of memory!\n"); + urj_error_set (URJ_ERROR_OUT_OF_MEMORY, "malloc(%zd) fails", + sizeof (s->shmem_size)); return NULL; } @@ -317,9 +316,9 @@ urj_jim_init (void) } else { - printf ("Out of memory!\n"); free (s->shmem); free (s); + // retain error state return NULL; } return s;