summaryrefslogtreecommitdiff
path: root/drivers/usb
diff options
context:
space:
mode:
authorJeff Garzik <jeff@garzik.org>2006-10-11 21:50:24 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2006-10-17 14:46:34 -0700
commitb3899dacafb10347b1b7a9f589b6c70cf8f08a3e (patch)
treee160123cd2538fdf1a9391fd910a11d61d9e47c2 /drivers/usb
parent5dfb5f1d060a6f7dfddb78dc59f9e4d299088cc1 (diff)
USB/gadget/net2280: handle sysfs errors
Signed-off-by: Jeff Garzik <jeff@garzik.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/gadget/net2280.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/drivers/usb/gadget/net2280.c b/drivers/usb/gadget/net2280.c
index d954daa8e9e0..7cfe0e5cf670 100644
--- a/drivers/usb/gadget/net2280.c
+++ b/drivers/usb/gadget/net2280.c
@@ -2044,8 +2044,10 @@ int usb_gadget_register_driver (struct usb_gadget_driver *driver)
return retval;
}
- device_create_file (&dev->pdev->dev, &dev_attr_function);
- device_create_file (&dev->pdev->dev, &dev_attr_queues);
+ retval = device_create_file (&dev->pdev->dev, &dev_attr_function);
+ if (retval) goto err_unbind;
+ retval = device_create_file (&dev->pdev->dev, &dev_attr_queues);
+ if (retval) goto err_func;
/* ... then enable host detection and ep0; and we're ready
* for set_configuration as well as eventual disconnect.
@@ -2060,6 +2062,14 @@ int usb_gadget_register_driver (struct usb_gadget_driver *driver)
/* pci writes may still be posted */
return 0;
+
+err_func:
+ device_remove_file (&dev->pdev->dev, &dev_attr_function);
+err_unbind:
+ driver->unbind (&dev->gadget);
+ dev->gadget.dev.driver = NULL;
+ dev->driver = NULL;
+ return retval;
}
EXPORT_SYMBOL (usb_gadget_register_driver);
@@ -2974,8 +2984,10 @@ static int net2280_probe (struct pci_dev *pdev, const struct pci_device_id *id)
: "disabled");
the_controller = dev;
- device_register (&dev->gadget.dev);
- device_create_file (&pdev->dev, &dev_attr_registers);
+ retval = device_register (&dev->gadget.dev);
+ if (retval) goto done;
+ retval = device_create_file (&pdev->dev, &dev_attr_registers);
+ if (retval) goto done;
return 0;