On Mon, Mar 06, 2017 at 10:27:09AM +0100, Johan Hovold wrote: > On Sat, Mar 04, 2017 at 02:21:28AM +0800, kbuild test robot wrote: > > Hi Johan, > > > > [auto build test WARNING on usb/usb-testing] > > [also build test WARNING on v4.10 next-20170303] > > [if your patch is applied to the wrong git tree, please drop us a note to help improve the system] > > > > url: https://github.com/0day-ci/linux/commits/Johan-Hovold/USB-serial-refactor-endpoint-sanity-checks/20170303-232312 > > base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing > > config: x86_64-randconfig-s0-03040020 (attached as .config) > > compiler: gcc-4.4 (Debian 4.4.7-8) 4.4.7 > > reproduce: > > # save the attached .config to linux build tree > > make ARCH=x86_64 > > > > All warnings (new ones prefixed by >>): > > > > drivers/usb/serial/usb-serial.c: In function 'usb_serial_probe': > > drivers/usb/serial/usb-serial.c:1088: warning: label 'err_free_epds' defined but not used > > >> drivers/usb/serial/usb-serial.c:767: warning: unused variable 'iface_desc' > > Ah, both of these warning only show up when neither > CONFIG_USB_SERIAL_PL2303 or CONFIG_USB_SERIAL_GENERIC is selected. Both > of these conditionally compile sections will be removed by a follow-on > series, but I'll respin this one to get rid of the warning in this > configuration nonetheless. So I've fixed this up by moving the descriptor pointer to the conditionally compiled section, and by not adding the new error label until a later patch in this series that needs it unconditionally. The resulting diff of this change is below, but I don't think I need to repost the whole series unless further changes are needed. Johan diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c index 68af80540000..09eb639298c8 100644 --- a/drivers/usb/serial/usb-serial.c +++ b/drivers/usb/serial/usb-serial.c @@ -764,7 +764,6 @@ static int usb_serial_probe(struct usb_interface *interface, struct usb_device *dev = interface_to_usbdev(interface); struct usb_serial *serial = NULL; struct usb_serial_port *port; - struct usb_host_interface *iface_desc; struct usb_endpoint_descriptor *endpoint; struct usb_serial_endpoints *epds; struct usb_serial_driver *type = NULL; @@ -830,6 +829,8 @@ static int usb_serial_probe(struct usb_interface *interface, ((le16_to_cpu(dev->descriptor.idVendor) == SIEMENS_VENDOR_ID) && (le16_to_cpu(dev->descriptor.idProduct) == SIEMENS_PRODUCT_ID_EF81))) { if (interface != dev->actconfig->interface[0]) { + struct usb_host_interface *iface_desc; + /* check out the endpoints of the other interface*/ iface_desc = dev->actconfig->interface[0]->cur_altsetting; for (i = 0; i < iface_desc->desc.bNumEndpoints; ++i) { @@ -850,7 +851,8 @@ static int usb_serial_probe(struct usb_interface *interface, if (epds->num_bulk_in == 0 || epds->num_bulk_out == 0) { dev_info(ddev, "PL-2303 hack: descriptors matched but endpoints did not\n"); retval = -ENODEV; - goto err_free_epds; + kfree(epds); + goto err_put_serial; } } /* END HORRIBLE HACK FOR PL2303 */ @@ -862,7 +864,8 @@ static int usb_serial_probe(struct usb_interface *interface, if (num_ports == 0) { dev_err(ddev, "Generic device with no bulk out, not allowed.\n"); retval = -EIO; - goto err_free_epds; + kfree(epds); + goto err_put_serial; } dev_info(ddev, "The \"generic\" usb-serial driver is only for testing and one-off prototypes.\n"); dev_info(ddev, "Tell linux-usb@xxxxxxxxxxxxxxx to add your device to a proper driver.\n"); @@ -1085,8 +1088,6 @@ static int usb_serial_probe(struct usb_interface *interface, probe_error: retval = -EIO; -err_free_epds: - kfree(epds); err_put_serial: usb_serial_put(serial); err_put_module: -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html