USB: gadget: android: check for null _android_dev in android_register_function()

This fixes a load ordering issue that occurred if a function driver loads before
the android gadget driver is initialized.

Signed-off-by: Mike Lockwood <lockwood@android.com>
This commit is contained in:
Mike Lockwood
2010-03-17 15:42:29 -04:00
parent 00dc766f66
commit 4bcc593ad9

View File

@@ -313,7 +313,7 @@ void android_register_function(struct android_usb_function *f)
/* bind our functions if they have all registered
* and the main driver has bound.
*/
if (dev->config && _registered_function_count == dev->num_functions)
if (dev && dev->config && _registered_function_count == dev->num_functions)
bind_functions(dev);
}