From: Mike Lockwood Date: Wed, 17 Mar 2010 19:42:29 +0000 (-0400) Subject: USB: gadget: android: check for null _android_dev in android_register_function() X-Git-Tag: firefly_0821_release~11622 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=4bcc593ad967fd7ff1c30f61cb6ea5dc91b8c1a0;p=firefly-linux-kernel-4.4.55.git 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 --- diff --git a/drivers/usb/gadget/android.c b/drivers/usb/gadget/android.c index 70e48ac3e2a9..3c4d44d663c0 100644 --- a/drivers/usb/gadget/android.c +++ b/drivers/usb/gadget/android.c @@ -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); }