It is possible for the VBUS detect GPIO interrupt to occur before nop_set_peripheral() is called, in which case otg->gadget is NULL. Signed-off-by: Maarten ter Huurne <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>