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>
1 parent 8938752 commit 418add62c1391ae9195ec1c145906332732dc93c
@Sebastian Hesselbarth Sebastian Hesselbarth authored on 26 Jul 2014
Sascha Hauer committed on 28 Jul 2014
Showing 3 changed files
View
drivers/usb/core/hub.c
View
drivers/usb/core/usb.c
View
drivers/usb/core/usb.h