diff options
author | Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com> | 2014-07-26 17:24:41 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2014-07-28 07:31:18 +0200 |
commit | 418add62c1391ae9195ec1c145906332732dc93c (patch) | |
tree | 003cf89540923cbda11c41cd2c19ba0fe1c19a41 /drivers/usb/core/usb.h | |
parent | 8938752dd883b03003701264fcb2bf96522e728f (diff) | |
download | barebox-418add62c1391ae9195ec1c145906332732dc93c.tar.gz barebox-418add62c1391ae9195ec1c145906332732dc93c.tar.xz |
USB: improve error paths and tear-down
USB core isn't too strict about allocation/deallocation and
add/remove sequences of usb devices. Especially, error paths
and device tear-down are kind of broken and cause hangs on
failing usb device detect.
This patch improves the situation by introducing a
usb_free_device() that tears down allocated resources by
usb_alloc_new_device(). usb_remove_device() now only deals
with resources that have been added by usb_new_device().
Also, error handling is fixed or improved to ensure that no
devices are unregistered that have not been previously
registered.
Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers/usb/core/usb.h')
-rw-r--r-- | drivers/usb/core/usb.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/usb/core/usb.h b/drivers/usb/core/usb.h index a0c05506dd..a5bb255121 100644 --- a/drivers/usb/core/usb.h +++ b/drivers/usb/core/usb.h @@ -2,6 +2,7 @@ #define __CORE_USB_H struct usb_device *usb_alloc_new_device(void); +void usb_free_device(struct usb_device *dev); int usb_new_device(struct usb_device *dev); void usb_remove_device(struct usb_device *dev); |