am7xxx: fix the error path of the second configuration check
authorAntonio Ospite <ao2@ao2.it>
Mon, 20 Apr 2015 14:42:02 +0000 (16:42 +0200)
committerAntonio Ospite <ao2@ao2.it>
Mon, 20 Apr 2015 16:03:55 +0000 (18:03 +0200)
Return a negative error value when the configuration check done after
claiming the interface fails, and also fix the output messages.

src/am7xxx.c

index 6595ccf..1c3f704 100644 (file)
@@ -774,9 +774,9 @@ static int open_device(am7xxx_context *ctx,
        current_configuration = -1;
        libusb_get_configuration((*dev)->usb_device, &current_configuration);
        if (current_configuration != (*dev)->desc->configuration) {
        current_configuration = -1;
        libusb_get_configuration((*dev)->usb_device, &current_configuration);
        if (current_configuration != (*dev)->desc->configuration) {
-               debug(ctx, "libusb configuration changed\n");
-               debug(ctx, "Cannot claim interface %hhu\n",
-                     (*dev)->desc->interface_number);
+               debug(ctx, "libusb configuration changed (expected: %hhu, current: %hhu\n",
+                     (*dev)->desc->configuration, current_configuration);
+               ret = -EINVAL;
                goto out_libusb_close;
        }
 out:
                goto out_libusb_close;
        }
 out: