From: Michael Gernoth Date: Wed, 29 May 2013 14:10:18 +0000 (+0200) Subject: remove duplicate code X-Git-Tag: v0.100~107 X-Git-Url: https://git.zerfleddert.de/cgi-bin/gitweb.cgi/hmcfgusb/commitdiff_plain/27bb301b7f08c691d95bed7b935a0c0a0144373d?hp=9db2e455127fa181c68cf093d23fe0c1ee142925 remove duplicate code --- diff --git a/hmcfgusb.c b/hmcfgusb.c index 0e45cbc..9b00c84 100644 --- a/hmcfgusb.c +++ b/hmcfgusb.c @@ -214,21 +214,13 @@ static void LIBUSB_CALL hmcfgusb_interrupt(struct libusb_transfer *transfer) quit = EIO; return; } - - err = libusb_submit_transfer(transfer); - if (err != 0) { - fprintf(stderr, "Can't re-submit transfer: %s\n", usb_strerror(err)); - free(transfer->buffer); - libusb_free_transfer(transfer); - } - return; - } - - cb_data = transfer->user_data; - if (cb_data && cb_data->cb) { - cb_data->cb(transfer->buffer, transfer->actual_length, cb_data->data); } else { - hexdump(transfer->buffer, transfer->actual_length, "RECV> "); + cb_data = transfer->user_data; + if (cb_data && cb_data->cb) { + cb_data->cb(transfer->buffer, transfer->actual_length, cb_data->data); + } else { + hexdump(transfer->buffer, transfer->actual_length, "RECV> "); + } } err = libusb_submit_transfer(transfer); @@ -389,7 +381,7 @@ int hmcfgusb_poll(struct hmcfgusb_dev *dev, int timeout) memset(&tv, 0, sizeof(tv)); err = libusb_handle_events_timeout_completed(NULL, &tv, NULL); if (err < 0) { - fprintf(stderr, "libusb_handle_events_completed: %s\n", usb_strerror(err)); + fprintf(stderr, "libusb_handle_events_timeout_completed: %s\n", usb_strerror(err)); errno = EIO; return -1; }