summaryrefslogtreecommitdiff
path: root/firmware/usbstack/core/core.c
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/core.c
parent195ef597f5347d29a75eacad3f674bf635e791e5 (diff)
downloadrockbox-4474d6827c5f08bd0e9a9ba91fc8bf149df21d28.tar.gz
rockbox-4474d6827c5f08bd0e9a9ba91fc8bf149df21d28.zip
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/core.c')
-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 e201b7547f..2fbec5d571 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) {
378 378
379static void bind_device_driver(struct usb_device_driver* driver) { 379static void bind_device_driver(struct usb_device_driver* driver) {
380 380
381 int ret = 0;
382
381 /* look if there is an old driver */ 383 /* look if there is an old driver */
382 if (usbcore.active_controller->device_driver != NULL) { 384 if (usbcore.active_controller->device_driver != NULL) {
383 usbcore.active_controller->device_driver->unbind(); 385 usbcore.active_controller->device_driver->unbind();
@@ -387,7 +389,11 @@ static void bind_device_driver(struct usb_device_driver* driver) {
387 usbcore.active_controller->device_driver = driver; 389 usbcore.active_controller->device_driver = driver;
388 390
389 /* init dirver */ 391 /* init dirver */
390 driver->bind(usbcore.active_controller->controller_ops); 392 ret = driver->bind(usbcore.active_controller->controller_ops);
391}
392
393 393
394 if (ret != 0) {
395 logf("binding of %s failed", driver->name);
396 usbcore.active_controller->device_driver = NULL;
397 usbcore.device_driver = NULL;
398 }
399}