Re: defected usb-serial config. fix (Re: [patch 2.6.21-rc5] usb-serial, ti_usb: fix usb configuration changing)

Oliver Neukum <[email protected]>
Newsgroups gmane.linux.usb.devel
Organization Novell
Message-ID <[email protected]>
Am Mittwoch, 4. April 2007 11:02 schrieb Oleg Verych:
> Would you like to add '-p' option to 'diff', to see a function name.
> 

Certainly.

	Regards
		Oliver
----
--- a/drivers/usb/serial/usb-serial.c	2007-04-02 17:19:15.000000000 +0200
+++ b/drivers/usb/serial/usb-serial.c	2007-04-02 17:22:20.000000000 +0200
@@ -969,17 +969,24 @@ int usb_serial_probe(struct usb_interfac
 	} else if (num_interrupt_out) {
 		dbg("the device claims to support interrupt out transfers, but write_int_callback is not defined");
 	}
-	
-	/* if this device type has an attach function, call it */
+
+	if (get_free_serial (serial, num_ports, &minor) == NULL) {
+		dev_err(&interface->dev, "No more free serial devices\n");
+		goto probe_error;
+	}
+	serial->minor = minor;
+
+	/* if this device type has an attach function, call it
+	 * now as the minors are known but the device not registered */
 	if (type->attach) {
 		if (!try_module_get(type->driver.owner)) {
 			dev_err(&interface->dev, "module get failed, exiting\n");
-			goto probe_error;
+			goto full_error;
 		}
 		retval = type->attach (serial);
 		module_put(type->driver.owner);
 		if (retval < 0)
-			goto probe_error;
+			goto full_error;
 		if (retval > 0) {
 			/* quietly accept this device, but don't bind to a serial port
 			 * as it's about to disappear */
@@ -987,12 +994,6 @@ int usb_serial_probe(struct usb_interfac
 		}
 	}
 
-	if (get_free_serial (serial, num_ports, &minor) == NULL) {
-		dev_err(&interface->dev, "No more free serial devices\n");
-		goto probe_error;
-	}
-	serial->minor = minor;
-
 	/* register all of the individual ports with the driver core */
 	for (i = 0; i < num_ports; ++i) {
 		port = serial->port[i];
@@ -1016,6 +1017,8 @@ exit:
 	usb_set_intfdata (interface, serial);
 	return 0;
 
+full_error:
+	return_serial(serial);
 probe_error:
 	for (i = 0; i < num_bulk_in; ++i) {
 		port = serial->port[i];

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.