Browse Source

fix segfautl when using mehfet with no vid/pid specified

mehfet
sys64738 2 months ago
parent
commit
bafd1465c9
  1. 6
      drivers/mehfet.c
  2. 4
      transport/mehfet_xport.c

6
drivers/mehfet.c

@ -553,11 +553,11 @@ static void mehfet_destroy(device_t dev_base) {
printc_dbg("mehfet: releasing device & disconnecting\n");
#endif
jtag_release_device(&dev->jtag, 0xfffe); // 0xfffe=reset address : POR
if (dev->trans) {
jtag_release_device(&dev->jtag, 0xfffe); // 0xfffe=reset address : POR
mehfet_cmd_disconnect(dev->trans);
mehfet_cmd_disconnect(dev->trans);
if (dev->trans) {
dev->trans->ops->destroy(dev->trans);
dev->trans = NULL;
}

4
transport/mehfet_xport.c

@ -241,6 +241,8 @@ transport_t mehfet_transport_open(const char *devpath,
dev = usbutil_find_by_id(*vendor, *product, requested_serial);
if (!dev) {
printc_err("mehfet: no USB device found.%s\n",
vendor ? "" : " (Did you forget to specify a VID:PID?)");
free(tr);
return NULL;
}
@ -248,7 +250,7 @@ transport_t mehfet_transport_open(const char *devpath,
tr->buf_size = 64; // initial conservative value, will get updated later
if (open_device(tr, dev) < 0) {
printc_err("ftdi: failed to open device\n");
printc_err("mehfet: failed to open device\n");
free(tr);
return NULL;
}

Loading…
Cancel
Save