Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 209875
b: refs/heads/master
c: d92a3ca
h: refs/heads/master
i:
  209873: 9fc50f5
  209871: a76c370
v: v3
  • Loading branch information
Ming Lei authored and Greg Kroah-Hartman committed Aug 24, 2010
1 parent db370dc commit d7aad1b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 17 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 0eee6a2b2a52e17066a572d30ad2805d3ebc7508
refs/heads/master: d92a3ca689257c6bec94e026538782c280afaaab
23 changes: 7 additions & 16 deletions trunk/drivers/usb/serial/usb-serial.c
Original file line number Diff line number Diff line change
Expand Up @@ -736,6 +736,7 @@ int usb_serial_probe(struct usb_interface *interface,

serial = create_serial(dev, interface, type);
if (!serial) {
module_put(type->driver.owner);
dev_err(&interface->dev, "%s - out of memory\n", __func__);
return -ENOMEM;
}
Expand All @@ -746,11 +747,11 @@ int usb_serial_probe(struct usb_interface *interface,

id = get_iface_id(type, interface);
retval = type->probe(serial, id);
module_put(type->driver.owner);

if (retval) {
dbg("sub driver rejected device");
kfree(serial);
module_put(type->driver.owner);
return retval;
}
}
Expand Down Expand Up @@ -822,6 +823,7 @@ 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);
module_put(type->driver.owner);
return -ENODEV;
}
}
Expand All @@ -835,22 +837,15 @@ int usb_serial_probe(struct usb_interface *interface,
dev_err(&interface->dev,
"Generic device with no bulk out, not allowed.\n");
kfree(serial);
module_put(type->driver.owner);
return -EIO;
}
}
#endif
if (!num_ports) {
/* if this device type has a calc_num_ports function, call it */
if (type->calc_num_ports) {
if (!try_module_get(type->driver.owner)) {
dev_err(&interface->dev,
"module get failed, exiting\n");
kfree(serial);
return -EIO;
}
if (type->calc_num_ports)
num_ports = type->calc_num_ports(serial);
module_put(type->driver.owner);
}
if (!num_ports)
num_ports = type->num_ports;
}
Expand Down Expand Up @@ -1039,13 +1034,7 @@ int usb_serial_probe(struct usb_interface *interface,

/* if this device type has an attach function, call it */
if (type->attach) {
if (!try_module_get(type->driver.owner)) {
dev_err(&interface->dev,
"module get failed, exiting\n");
goto probe_error;
}
retval = type->attach(serial);
module_put(type->driver.owner);
if (retval < 0)
goto probe_error;
serial->attached = 1;
Expand Down Expand Up @@ -1088,10 +1077,12 @@ int usb_serial_probe(struct usb_interface *interface,
exit:
/* success */
usb_set_intfdata(interface, serial);
module_put(type->driver.owner);
return 0;

probe_error:
usb_serial_put(serial);
module_put(type->driver.owner);
return -EIO;
}
EXPORT_SYMBOL_GPL(usb_serial_probe);
Expand Down

0 comments on commit d7aad1b

Please sign in to comment.