aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/usb/gadget/at91_udc.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/drivers/usb/gadget/at91_udc.c b/drivers/usb/gadget/at91_udc.c
index 1926d39e4801..812c733ba8ce 100644
--- a/drivers/usb/gadget/at91_udc.c
+++ b/drivers/usb/gadget/at91_udc.c
@@ -955,7 +955,10 @@ static int at91_vbus_session(struct usb_gadget *gadget, int is_active)
955 // VDBG("vbus %s\n", is_active ? "on" : "off"); 955 // VDBG("vbus %s\n", is_active ? "on" : "off");
956 local_irq_save(flags); 956 local_irq_save(flags);
957 udc->vbus = (is_active != 0); 957 udc->vbus = (is_active != 0);
958 pullup(udc, is_active); 958 if (udc->driver)
959 pullup(udc, is_active);
960 else
961 pullup(udc, 0);
959 local_irq_restore(flags); 962 local_irq_restore(flags);
960 return 0; 963 return 0;
961} 964}
@@ -1241,7 +1244,10 @@ static void handle_setup(struct at91_udc *udc, struct at91_ep *ep, u32 csr)
1241#undef w_length 1244#undef w_length
1242 1245
1243 /* pass request up to the gadget driver */ 1246 /* pass request up to the gadget driver */
1244 status = udc->driver->setup(&udc->gadget, &pkt.r); 1247 if (udc->driver)
1248 status = udc->driver->setup(&udc->gadget, &pkt.r);
1249 else
1250 status = -ENODEV;
1245 if (status < 0) { 1251 if (status < 0) {
1246stall: 1252stall:
1247 VDBG("req %02x.%02x protocol STALL; stat %d\n", 1253 VDBG("req %02x.%02x protocol STALL; stat %d\n",