aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/core
diff options
context:
space:
mode:
authorAlan Stern <stern@rowland.harvard.edu>2010-01-08 12:56:04 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2010-03-02 14:54:05 -0800
commit0f3dda9f7ff2db8dbf4d6fbab4d4438251446002 (patch)
tree49747d93608ae1d81e373bb43efa17ed651d2b2e /drivers/usb/core
parentd837e219daf3bf0cc84fcfb9781807d9fe8d03b5 (diff)
downloadkernel_samsung_smdk4412-0f3dda9f7ff2db8dbf4d6fbab4d4438251446002.zip
kernel_samsung_smdk4412-0f3dda9f7ff2db8dbf4d6fbab4d4438251446002.tar.gz
kernel_samsung_smdk4412-0f3dda9f7ff2db8dbf4d6fbab4d4438251446002.tar.bz2
USB: rearrange code in usb_probe_interface
This patch (as1322) reverses the two outcomes of an "if" statement in usb_probe_interface(), to avoid an unnecessary level of indentation. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/core')
-rw-r--r--drivers/usb/core/driver.c63
1 files changed, 31 insertions, 32 deletions
diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c
index f2f055e..fcafb2d 100644
--- a/drivers/usb/core/driver.c
+++ b/drivers/usb/core/driver.c
@@ -274,56 +274,55 @@ static int usb_probe_interface(struct device *dev)
intf->needs_binding = 0;
if (usb_device_is_owned(udev))
- return -ENODEV;
+ return error;
if (udev->authorized == 0) {
dev_err(&intf->dev, "Device is not authorized for usage\n");
- return -ENODEV;
+ return error;
}
id = usb_match_id(intf, driver->id_table);
if (!id)
id = usb_match_dynamic_id(intf, driver);
- if (id) {
- dev_dbg(dev, "%s - got id\n", __func__);
-
- error = usb_autoresume_device(udev);
- if (error)
- return error;
+ if (!id)
+ return error;
- /* Interface "power state" doesn't correspond to any hardware
- * state whatsoever. We use it to record when it's bound to
- * a driver that may start I/0: it's not frozen/quiesced.
- */
- mark_active(intf);
- intf->condition = USB_INTERFACE_BINDING;
+ dev_dbg(dev, "%s - got id\n", __func__);
- /* The interface should always appear to be in use
- * unless the driver suports autosuspend.
- */
- atomic_set(&intf->pm_usage_cnt, !driver->supports_autosuspend);
+ error = usb_autoresume_device(udev);
+ if (error)
+ return error;
- /* Carry out a deferred switch to altsetting 0 */
- if (intf->needs_altsetting0) {
- error = usb_set_interface(udev, intf->altsetting[0].
- desc.bInterfaceNumber, 0);
- if (error < 0)
- goto err;
+ /* Interface "power state" doesn't correspond to any hardware
+ * state whatsoever. We use it to record when it's bound to
+ * a driver that may start I/0: it's not frozen/quiesced.
+ */
+ mark_active(intf);
+ intf->condition = USB_INTERFACE_BINDING;
- intf->needs_altsetting0 = 0;
- }
+ /* The interface should always appear to be in use
+ * unless the driver suports autosuspend.
+ */
+ atomic_set(&intf->pm_usage_cnt, !driver->supports_autosuspend);
- error = driver->probe(intf, id);
- if (error)
+ /* Carry out a deferred switch to altsetting 0 */
+ if (intf->needs_altsetting0) {
+ error = usb_set_interface(udev, intf->altsetting[0].
+ desc.bInterfaceNumber, 0);
+ if (error < 0)
goto err;
-
- intf->condition = USB_INTERFACE_BOUND;
- usb_autosuspend_device(udev);
+ intf->needs_altsetting0 = 0;
}
+ error = driver->probe(intf, id);
+ if (error)
+ goto err;
+
+ intf->condition = USB_INTERFACE_BOUND;
+ usb_autosuspend_device(udev);
return error;
-err:
+ err:
mark_quiesced(intf);
intf->needs_remote_wakeup = 0;
intf->condition = USB_INTERFACE_UNBOUND;