[patch]missing error check in probing

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If usb_set_interface() needs to be called during probing, it
may return an error which needs to be checked for.

Signed-off-by: Oliver Neukum <oliver@xxxxxxxxxx>

--

commit 626b5bc57ef32d6950dc3ee315bb110afa100af7
Author: Oliver Neukum <oliver@xxxxxxxxxx>
Date:   Wed Aug 26 23:53:42 2009 +0200

    usb: check for IO errors usb_set_interface can return while probing

diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c
index 69e5773..e07ce04 100644
--- a/drivers/usb/core/driver.c
+++ b/drivers/usb/core/driver.c
@@ -236,24 +236,30 @@ static int usb_probe_interface(struct device *dev)
 
 		/* Carry out a deferred switch to altsetting 0 */
 		if (intf->needs_altsetting0) {
-			usb_set_interface(udev, intf->altsetting[0].
+			error = usb_set_interface(udev, intf->altsetting[0].
 					desc.bInterfaceNumber, 0);
+			if (error < 0)
+				goto err;
+
 			intf->needs_altsetting0 = 0;
 		}
 
 		error = driver->probe(intf, id);
-		if (error) {
-			mark_quiesced(intf);
-			intf->needs_remote_wakeup = 0;
-			intf->condition = USB_INTERFACE_UNBOUND;
-			usb_cancel_queued_reset(intf);
-		} else
-			intf->condition = USB_INTERFACE_BOUND;
+		if (error)
+			goto err;
 
+		intf->condition = USB_INTERFACE_BOUND;
 		usb_autosuspend_device(udev);
 	}
 
 	return error;
+
+err:
+	mark_quiesced(intf);
+	intf->needs_remote_wakeup = 0;
+	intf->condition = USB_INTERFACE_UNBOUND;
+	usb_cancel_queued_reset(intf);
+	return error;
 }
 
 /* called from driver core with dev locked */

--
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

[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux