summaryrefslogtreecommitdiff
path: root/firmware/usbstack/core
diff options
context:
space:
mode:
authorChristian Gmeiner <christian.gmeiner@gmail.com>2007-08-28 20:50:41 +0000
committerChristian Gmeiner <christian.gmeiner@gmail.com>2007-08-28 20:50:41 +0000
commit4474d6827c5f08bd0e9a9ba91fc8bf149df21d28 (patch)
tree4926ee8a2bd49f4c76062724f28d01a471d63b53 /firmware/usbstack/core
parent195ef597f5347d29a75eacad3f674bf635e791e5 (diff)
downloadrockbox-4474d6827c5f08bd0e9a9ba91fc8bf149df21d28.zip
rockbox-4474d6827c5f08bd0e9a9ba91fc8bf149df21d28.tar.gz
rockbox-4474d6827c5f08bd0e9a9ba91fc8bf149df21d28.tar.bz2
rockbox-4474d6827c5f08bd0e9a9ba91fc8bf149df21d28.tar.xz
binding a device driver could fail.. handle this case
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14493 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/usbstack/core')
-rw-r--r--firmware/usbstack/core/core.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/firmware/usbstack/core/core.c b/firmware/usbstack/core/core.c
index e201b75..2fbec5d 100644
--- a/firmware/usbstack/core/core.c
+++ b/firmware/usbstack/core/core.c
@@ -378,6 +378,8 @@ static void update_driver_names(unsigned char* result) {
static void bind_device_driver(struct usb_device_driver* driver) {
+ int ret = 0;
+
/* look if there is an old driver */
if (usbcore.active_controller->device_driver != NULL) {
usbcore.active_controller->device_driver->unbind();
@@ -387,7 +389,11 @@ static void bind_device_driver(struct usb_device_driver* driver) {
usbcore.active_controller->device_driver = driver;
/* init dirver */
- driver->bind(usbcore.active_controller->controller_ops);
-}
-
+ ret = driver->bind(usbcore.active_controller->controller_ops);
+ if (ret != 0) {
+ logf("binding of %s failed", driver->name);
+ usbcore.active_controller->device_driver = NULL;
+ usbcore.device_driver = NULL;
+ }
+}