Skip to content

tl866a: fail early when attempting to test a device with no test vectors

Lubomir Rintel requested to merge lkundrak/minipro:lr/sad-pwr-pins into master

Before:

  $ minipro -p ATF20V8B -T
  ...
  Segmentation fault (core dumped)
  $

The crash happens, because the first test vector is used to configure the power pins -- assuming a first test vector actually exists:

  #0  0x000000000040e0da in pwr_init (handle=0x4282a0, vector=0x0,
      pin_count=24) at tl866a.c:1223
  1223			if (vector[i] == LOGIC_G) {
  (gdb) print vector
  $3 = (uint8_t *) 0x0
  (gdb) bt
  #0  0x000000000040e0da in pwr_init (handle=0x4282a0, vector=0x0,
      pin_count=24) at tl866a.c:1223
  #1  0x000000000040e279 in do_ic_test (handle=0x4282a0) at tl866a.c:1253
  #2  0x000000000040e6b8 in tl866a_logic_ic_test (handle=0x4282a0)
      at tl866a.c:1374
  #3  0x000000000040b290 in minipro_logic_ic_test (handle=0x4282a0)
      at minipro.c:646
  #4  0x000000000041d41f in main (argc=4, argv=0x7fffffffddf8) at main.c:2998

With the patch:

  $ minipro -p ATF20V8B -T
  ...
  Error running logic test.
  $

Very lovely.

Merge request reports