usb_endpoint_is_bulk_out(&intf->endpoint[1].desc)) {
dev_dbg(dev, "QDL port found\n");
- if (serial->interface->num_altsetting == 1) {
+ if (serial->interface->num_altsetting == 1)
retval = 0; /* Success */
- break;
- }
- altsetting = 1;
+ else
+ altsetting = 1;
}
break;
default:
dev_err(dev, "unknown number of interfaces: %d\n", nintf);
- kfree(data);
- retval = -ENODEV;
}
if (altsetting >= 0) {
"Could not set interface, error %d\n",
retval);
retval = -ENODEV;
- kfree(data);
}
}
- /* Set serial->private if not returning -ENODEV */
- if (retval != -ENODEV)
+ /* Set serial->private if not returning error */
+ if (retval == 0)
usb_set_serial_data(serial, data);
+ else
+ kfree(data);
+
return retval;
}