]> git.zerfleddert.de Git - hmcfgusb/commitdiff
remove duplicate code
authorMichael Gernoth <michael@gernoth.net>
Wed, 29 May 2013 14:10:18 +0000 (16:10 +0200)
committerMichael Gernoth <michael@gernoth.net>
Wed, 29 May 2013 14:10:18 +0000 (16:10 +0200)
hmcfgusb.c

index 0e45cbc59ec68b50c488964510d138437df3f786..9b00c84eecb43dbd51b88ce33f59dc81140bd213 100644 (file)
@@ -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;
                }
Impressum, Datenschutz