diff options
Diffstat (limited to 'drivers/usb/serial/usb-serial.c')
| -rw-r--r-- | drivers/usb/serial/usb-serial.c | 12 | 
1 files changed, 7 insertions, 5 deletions
diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c index 6a1b609a0d9..27483f91a4a 100644 --- a/drivers/usb/serial/usb-serial.c +++ b/drivers/usb/serial/usb-serial.c @@ -659,12 +659,14 @@ exit:  static struct usb_serial_driver *search_serial_device(  					struct usb_interface *iface)  { -	const struct usb_device_id *id; +	const struct usb_device_id *id = NULL;  	struct usb_serial_driver *drv; +	struct usb_driver *driver = to_usb_driver(iface->dev.driver);  	/* Check if the usb id matches a known device */  	list_for_each_entry(drv, &usb_serial_driver_list, driver_list) { -		id = get_iface_id(drv, iface); +		if (drv->usb_driver == driver) +			id = get_iface_id(drv, iface);  		if (id)  			return drv;  	} @@ -755,7 +757,7 @@ static int usb_serial_probe(struct usb_interface *interface,  		if (retval) {  			dbg("sub driver rejected device"); -			kfree(serial); +			usb_serial_put(serial);  			module_put(type->driver.owner);  			return retval;  		} @@ -827,7 +829,7 @@ static int usb_serial_probe(struct usb_interface *interface,  		 */  		if (num_bulk_in == 0 || num_bulk_out == 0) {  			dev_info(&interface->dev, "PL-2303 hack: descriptors matched but endpoints did not\n"); -			kfree(serial); +			usb_serial_put(serial);  			module_put(type->driver.owner);  			return -ENODEV;  		} @@ -841,7 +843,7 @@ static int usb_serial_probe(struct usb_interface *interface,  		if (num_ports == 0) {  			dev_err(&interface->dev,  			    "Generic device with no bulk out, not allowed.\n"); -			kfree(serial); +			usb_serial_put(serial);  			module_put(type->driver.owner);  			return -EIO;  		}  |